I know self is the receiver of the method calling.
But I do not know if there is not self in method definition.
code example:
class One
def kk
"kk"
end
def self.kkk
"kkk"
end
end
puts One.new.kk
puts One.kkk
Why do I need to use new method for One used like One.new.kk ?
self.kkkhere defines a class method ofOne. As you know,selfis the receiver. In the context here it is theOneclass.And
One.newreturns an instance of classOne.kkis an instance method that only called by an instance.