On Sat, Feb 16, 2013 at 9:46 PM, Love U Ruby <[email protected]> wrote:
> That's why array#replace allowed on the frozen array, but none of the
It isn't
irb(main):001:0> a=10.times.to_a.freeze
=> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
irb(main):002:0> a.replace [10,20]
RuntimeError: can't modify frozen Array
from (irb):2:in `replace'
from (irb):2
from /usr/bin/irb:12:in `<main>'
> array#pop,array#push,array#rotate! etc not allowed.
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
--
[email protected] |
https://groups.google.com/d/forum/ruby-talk-google?hl=en
---
You received this message because you are subscribed to the Google Groups
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.