The below code is running properly :
module Mod
def one
"This is one"
end
module_function :one
end
Below is throwing error :
class Mod
def one
"This is one"
end
module_function :one
end
# ~> -:5:in `<class:Mod>': undefined method `module_function' for
Mod:Class (NoMethodError)
# ~> from -:1:in `<main>'
Why is such design?
···
--
Posted via http://www.ruby-forum.com/.