I have troubles with understanding the global area of visibility in Ruby, so, I know that you cant use Module methods in your own class for example:
module Mod
def self.meth
“module method”
end
end
class Klass
include Mod
end
p Klass.meth
# Error
but when i knew that you can do such thing:
include Math
p sin 2
#0.909....
I was confused, because i thought you cant use module methods in any class without calling the method name. Also i had a supposition, that module Math has instance methods, like Kernel, but, unfortunately, no. Now i am doubting, that I understood such methods like extend and include correctly, so, could you please explain to me this thing and what will happen if we will change include to extend