mardi 6 décembre 2016

How to pass service objects/modules as arguments in ruby

Is it possible to use Module or objects as arguments for each method in ruby?

I need something like.

module PrintAny
  def call(text)
    puts text
   end
end

["any"].each PrintAny

Aucun commentaire:

Enregistrer un commentaire