Skip to content
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

(MODULES-1439) Adds any2bool function #601

Merged
merged 1 commit into from
May 5, 2016

Conversation

petems
Copy link
Contributor

@petems petems commented Apr 27, 2016

  • Basically a combination of string2bool and num2bool

So there's a request for this to be added to stdlib (https://tickets.puppetlabs.com/browse/MODULES-1439).

Questions:

  • Do we want to muddle the waters by the string casting to numeric part to the check? So should '-1' be true because it's a string, or false because when num2bool its false?
  • There's already a any2bool as part of puppi, should we give this a different name?

@petems petems force-pushed the MODULES-1439-any2bool_added branch from f03bf46 to c5a6024 Compare April 27, 2016 13:11
* Basically a combination of `string2bool` and `num2bool`
@petems petems force-pushed the MODULES-1439-any2bool_added branch from c5a6024 to 420f76d Compare May 2, 2016 19:05
@hunner
Copy link
Contributor

hunner commented May 5, 2016

Do we want to muddle the waters by the string casting to numeric part to the check? So should '-1' be true because it's a string, or false because when num2bool its false?

Sure, that makes it work on puppet 3 and 4 the same way.

There's already a any2bool as part of puppi, should we give this a different name?

I think that puppi's purpose is different from stdlib's purpose, so example42 can do namespacing as needed similar to when functions migrate from other modules to stdlib. Thanks for catching that!

@bmjen bmjen merged commit b2165df into puppetlabs:master May 5, 2016
@nibalizer
Copy link
Contributor

+1

@bmjen
Copy link
Contributor

bmjen commented May 5, 2016

Thanks @petems !

@nibalizer
Copy link
Contributor

Note that we need to call out the puppi incompatibility in the changelog for the next release.

@petems
Copy link
Contributor Author

petems commented May 5, 2016

👍

end

describe 'when testing stringy values that mean "false"' do
[ 'FALSE','', '0', 'f', 'n', 'false', 'no', 'undef', 'undefined', nil, :undef ].each do |value|
Copy link
Contributor

Choose a reason for hiding this comment

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

'off' would also be good :D

@petems petems deleted the MODULES-1439-any2bool_added branch May 7, 2016 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants