]> gitweb.fluxo.info Git - puppet-stdlib.git/commit
Reworked number-handling logic
authorSteve Huff <shuff@vecna.org>
Fri, 29 Mar 2013 16:03:33 +0000 (12:03 -0400)
committerSteve Huff <shuff@vecna.org>
Fri, 29 Mar 2013 16:54:37 +0000 (12:54 -0400)
commit4a5218a8af8c3ffaf9ea2348a3900b19d6a95416
treea3d965b79112bfc025258831afb2467ecbb1c9bd
parente6916f83fd35989db4b86dfb10716c9198994389
Reworked number-handling logic

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.
lib/puppet/parser/functions/num2bool.rb
spec/unit/puppet/parser/functions/num2bool_spec.rb