From: Gary Wright Date: 2009-01-07T07:59:06+09:00 Subject: Re: Can I return the value of val with: def active=(val)? On Jan 6, 2009, at 4:58 PM, Anita Anita wrote: > How to return the value of val? > If I write: > def active=(val) > if user.active > val = t > else > val = z > end > I never saw a method using name=(value), I cannot use active? because > val needs to be different than true or false. > Anyone? Have you seen such a method before? where? I need an example It isn't clear what you are trying to accomplish. In your example, where are t and z coming from? Are they attributes of the class? Can you show us how you intend to use this method (rather than the definition shown above). I'm not sure if this is important to your use case, but the return value of an assignment method is ignored by Ruby so as to not confuse the assignment semantics: self.active = x will always evaluate to x regardless of how the method active= is written.