Hi,

irb(main):008:0> ("08".."12").to_a

> => ["08", "09", "10", "11", "12"]
>
> irb(main):010:0> (8..12).to_a
> => [8, 9, 10, 11, 12]
>
> But then, the range() function in stdlib, makes a type conversion, that 
> breaks this possibility. I don't understand why do you do that 
> conversion... the function is just an interface to the "range" capability 
> of Ruby, right? I think it should allow the programmer to choose the type 
> he wants.
>

"With great power comes great responsibility" -- said that, please allow 
yourself to understand the following example:

("abc01".."abc99 ").to_a

Observe this little (which may happen) mistake after "abc99". That is the 
easily over-looked single space.

If you do that in your manifest, let say ... by accident... then your 
Puppet Master will more likely become a happy candidate for OOM Killer to 
consider :)

Do you know if, after editing a .rb file, I have to force some kind of 
> reload to pick up the changes?
>

No, there is no need to reload, but this is not the solution. Instead, in 
order to guarantee safe execution and also provide desired effect a 
different approach can be taken: You can scan for how many string-encoded 
digits you can fine within start of the range, count then and then based on 
this counter collect (or map if you like Perl so much) generated range with 
relevant substitution. If done right, then it will allow you to 
zero-padding of any size at any place in the string e.g. test00, 00test 
this00test, etc ...

I will update my version f range shortly to do precisely that.

KW

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/SsdPCfKazJwJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to