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 `’
Why is such design?