A
arcadiorubiogarcia
Hi everyone,
I'm new to Ruby. I'm looking for an elegant solution to a simple
problem.
I have some classes like this one in my code:
class A
attr_reader :a1, a2
def initialize(a1, a2)
@a1 = a1
@a2 = a2
end
end
I'm looking for a way in order not to have to define the initialize
method in each class. Struct doesn't fit my needs since due to single
inheritance I can't have any other superclass, and I would like to.
Any suggestions?
Thanks in advance.
I'm new to Ruby. I'm looking for an elegant solution to a simple
problem.
I have some classes like this one in my code:
class A
attr_reader :a1, a2
def initialize(a1, a2)
@a1 = a1
@a2 = a2
end
end
I'm looking for a way in order not to have to define the initialize
method in each class. Struct doesn't fit my needs since due to single
inheritance I can't have any other superclass, and I would like to.
Any suggestions?
Thanks in advance.