From: Ilan Berci Date: 2006-12-15T01:56:51+09:00 Subject: Re: Maksim, I am not sure what you are trying to accomplish with the code below but I will go through line by line and let you know what each method will return to try to give you a better picture, Maksim Bartenev wrote: > Here's the actual code: > > class Parent > > def dummy > "dummy" > end This method simply returns a string of "dummy" > > def dummy=(arg) > puts 'weird stuff' > "dummy=" > end > This method entitled "dummy=" will NOT assign anything to anything and although it looks like a mutator, it isn't. It will simply print 'weird stuff' and return a string: dummy= > def set_dummy(arg) > "set_dummy" > end > Once again, this method appears to be affecting state, but it isn't. It simply returns a string: "set_dummy" > > class Child < Parent > > def try_dummy1 > puts(dummy) > end Calling this will print out: dummy as it will call Parent.dummy() which returns a string: dummy > > def try_dummy2 > puts(dummy = true) > end This will call out Parent.dummy=() which prints out: weird stuff and then returns the string: dummy= which is then printed out by this method. It's important to note, that once again no assignment is taking place here whatsoever, Is that what you are confused on? > > def try_dummy3 > puts(set_dummy(true)) > end > This method will call out Parent.set_dummy() which returns a string: set_dummy which this method then prints out.. I hope this has clarified some of your questions. I believe you are misusing string quotation marks but once again I am unsure of what you are trying to accomplish. ilan -- Posted via http://www.ruby-forum.com/.