Answers for "how to include ,multiple modules in ruby"

0

how to include ,multiple modules in ruby

class MyClass
  include MyModule1
  include MyModule2
  include MyModule3
end

The shorter way for the above code would be:
class MyClass
  include MyModule3, MyModule2, MyModule1
end

Remember always to reverse the order in the single line version, to keep the same ancestry order.
Posted by: Guest on November-26-2020

Browse Popular Code Answers by Language