G
George Moschovitis
Hello everyone,
I am looking for an elegant solution to a common problem.
Lets say I have 2 modules (A, B):
module A
attr_accessor :val1
attr_accessor :val2
def initialize
@val1 = @val2 = "A"
end
end
module B
attr_accessor :val3
attr_accessor :val4
def initialize
@val3 = @val4 = "B"
end
end
I include the modules in a news class:
class MyClass
include A, B
def initialize
# ???
end
end
Is there a way to automatically call the initialization code for the two
modules ? Is there a ruby idiom for this?
Thanks in advance for any help!
George Moschovitis
Navel
I am looking for an elegant solution to a common problem.
Lets say I have 2 modules (A, B):
module A
attr_accessor :val1
attr_accessor :val2
def initialize
@val1 = @val2 = "A"
end
end
module B
attr_accessor :val3
attr_accessor :val4
def initialize
@val3 = @val4 = "B"
end
end
I include the modules in a news class:
class MyClass
include A, B
def initialize
# ???
end
end
Is there a way to automatically call the initialization code for the two
modules ? Is there a ruby idiom for this?
Thanks in advance for any help!
George Moschovitis
Navel