I am shocked that we can change the value of constant in ruby!! is there any meaning if we can change the value of a constant!! I am not getting this,plz help! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/VIPVC93sjYUJ. For more options, visit https://groups.google.com/groups/opt_out.
On 21 Dec, 06:58, Nirav Bhatu <nirav.bha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am shocked that we can change the value of constant in ruby!! is there > any meaning if we can change the value of a constant!! I am not getting > this,plz help!Ruby lets you do most things if you want to - calling private methods, changing constants, redefining methods on core classes - with great power comes great responsibility! Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Nirav Bhatu wrote in post #1089902:> I am shocked that we can change the value of constant in ruby!! >What about this: class Dog def initialize(password) @secret = password end end d = Dog.new("flower52") puts d.instance_eval("@secret") --output:-- flower52 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.