Include module with same method name : include « Class « Ruby






Include module with same method name


module MyModule
  def potato
    'A'
  end
end

module ModuleB
  def potato
    'B'
  end
end

class Potato
  include MyModule
  include ModuleB
end

puts Potato.new.potato 

 








Related examples in the same category

1.Include a module into a class
2.Add extension from a module for an object not class
3.Extending Specific Objects with Modules