James Byrne wrote:
> James Byrne wrote:
>> Can someone see what I cannot given this code?
>
> I need a return in front of the statement.
>
> def initialize(source=nil)
> return xchg_source unless source
> xchg_source(source)
> end
Why not just let xchg_source deal with the nil then you just have:
def initialize(source=nil)
xchg_source(source)
end
protected # assuming this is not part of the public interface
def xchg_source(source)
if source
# whatever you do if source is given
else
# whatever should happen if source is nil
end
end
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---