summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/num2bool.rb
AgeCommit message (Collapse)Author
2017-03-01(MODULES-4473) join strings for i18n parserEric Putnam
This commit joins all strings that are split over two lines with a plus, backslash, or double less than so that our magical i18n parser can wave over the module and mark every ruby string with our i18n function.
2013-04-01Cleanup per adrianthebo suggestionsSteve Huff
* use Float() to process string arguments * get rid of doubly nested arrays * removing needless ternary operator * improving error message handling
2013-03-29(19864) num2bool match fixSteve Huff
This is a bit more heavy-handed than I might like, but it does appear to do the right things: * accepts numeric input appropriately, truncating floats * matches string input against a regex, then coerces number-looking strings to int * makes a best effort to coerce anything else to a string, then subjects it to the same treatment * raises an error in the event of incorrect number of arguments or non-number-looking strings I've also included some additional unit tests.
2013-03-29Reworked number-handling logicSteve Huff
No more coercing to String and regex matching. Instead, we now coerce to Integer at the beginning or raise an error if we cannot coerce to Integer. A consequence of this change is that the function will now accept blatantly non-numeric strings as input, and return false. This seems a bit goofy to me, but it's how String#to_i works. If we really don't like this, then I'm open to suggestions.
2013-03-29Enable num2bool to accept numeric inputSteve Huff
Also ignore rspec fixtures directory
2011-07-29(#3) Apply missing documentation to more functions.Ken Barber
2011-04-30Convert to module format.Ken Barber