Используйте метод super
! Ruby не имеет множественного наследования.
class B
attr_accessor :b, :bb
def initialize(b, bb)
@b, @bb = b, bb
end
end
module C
end
class A < B
include C # <= if C was a class, you'd get: TypeError: wrong argument type Class (expected Module)
attr_accessor :a, :aa
def initialize(a,b,aa,bb)
@a, @aa = a, aa
super(b, bb) # <= calls B#initialize
end
end
a = A.new(1,2,3,4)
puts a.inspect # => #<A:0x42d6d8 @aa=3, @a=1, @b=2, @bb=4>