S Conroy
0
Q:

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.
0

New to Communities?

Join the community