Lev Lukomskyi

Joined

10 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Module extend self Discussion

Personally I find it confusing that by extend self module methods are duplicated in singleton class. It's cleaner to just write this way:

module CurrencyFormatter
  class << self

    def format(*)
      # ...
    end

  end
end

Here the intent is clear – you have to just use this module as CurrencyFormatter.format(...), you cannot include it.