def moo puts "moo" end moo.moo.moo.moo this gives
moo moo moo moo just oddity, curious if done on purpose , served purpose...
i'm guessing you're doing in console, you're defining method on object, defines method on children of object... everything. method:
def moo puts "moo" end returns nil, , because defined method on object, nilclass has method well, can call moo on nilclass.
if do:
class foo def bar 1 + 1 end end and then:
f = foo.new f.bar.bar you get:
nomethoderror: undefined method `bar' 2:fixnum
Comments
Post a Comment