I know of two ways ruby allows static functions to call each other within the same class…
class MyClass
def self.foo
self.say "self"
end
def self.bar
MyClass.say "class name"
end
def self.say(text)
puts "Using #{text}"
end
end
Are there any subtle differences between the two syntaxes? Maybe performance?
No, those are exactly the same. Performance-wise too. The only difference is code maintainability. If you decide to move a method with explicit class reference to another class, there’s more work for you (or less, depending on a situation)
Oh, and there are no static methods in ruby.
Also, you don’t need to explicitly use
selfto call a method there.selfcan be implicit.