Plough => Ruby

Journey through ruby

Serendipity

I accidently found a nifty way of calling class singleton methods. Imagine you have this code:


class FoundANewWay
    def self.to_call_a_singleton_method
        puts "It works!"
    end
end

and you can call it like this:

FoundANewWay.to_call_a_singleton_method

or

FoundANewWay::to_call_a_singleton_method

Cool!