documentation:

"By default, all methods in Ruby classes are public - accessible by
anyone. There are, nonetheless, only two exceptions for this rule: the
global methods defined under the Object class, and the initialize
method for any class. Both of them are implicitly private."


>> class Object
>> def something
>> puts "something"
>> end
>> end
=> nil
>> class XYZ
>> end
=> nil
>> xyz = XYZ.new
=> #<XYZ:0x10d067580>
>> xyz.something
something

So then why was I able to access something?

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to