Ruby on Rails Thursday, August 29, 2013

> Please help me to understand what does mean by "If used with no
> arguments, subsequently defined methods become module functions."?

Okay got it now:-

module Party
module_function
def foo
"I am foo"
end
def bar
"I am bar"
end
end

Party.foo # => "I am foo"
Party.bar # => "I am bar"

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4325306fab9efe46f82cd965e21134ac%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment