jeudi 26 mars 2020

why instantiate a class method in ruby?

what is the idea behind creating a new instance of the method inside class << self construct? I understand methods are put under class << self block to make it class methods but what it means to creating a new instance of the method itself?

class foo
  class << self
     def bar(param)
       new.bar(some_param)
     end
  end
end

Aucun commentaire:

Enregistrer un commentaire