Skip to content

Improve parseyaml function #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dmitryilyin
Copy link

  • Add default value support
  • Update tests


data = YAML::load(arguments[0])
data = arguments[1] unless data
data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L17-19 could just be YAML::load(arguments[0]) || arguments[1] .

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@DavidS
Copy link
Contributor

DavidS commented Aug 24, 2015

Nice idea and good call on those additional specs :-) I've added a small comment on the style of the actual function body. The changes from the doc string need to be repeated in the README.

The main question though is why parseyaml needs a separate default value implementation when there is pick and pick_default ?

* Add default value support
  Second argument will be returned if yaml cannot be parsed
  instead of false value
* Update tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants