How to load the same method from different modules

Hi all,

I have 2 modules and each contains one method of same name.
I have one class to mix both of them. How can I call the method from
both modules at the same time? When I call #data, only the one loaded
last is being called?

Thanks,

Li

module Chapter6
def data
puts “I m 6”
end
end

module Chapter7
def data
puts “I m 7”
end
end

class My
include Chapter6
include Chapter7
end

obj=My.new
obj.data

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs