S
Simon Strandgaard
I have some class hierarchies located in different modules, but with
clashing names, thus I cannot 'include' the modules.
Basicly what im interested in is something similar to 'using' in pascal.
Any advice would be appreciated
Q1: using ?
Q2: Is it possible to make an alias for a module, so that I for instance
only have to type X::Test when I refer to LongModuleName1::Test ?
--
Simon Strandgaard
module LongModuleName1
class Test
def to_s; "1" end
end
end
class Test
def initialize
using(LongModuleName1) { # would be nice
@value = Test.new
}
end
def to_s
@value.to_s
end
end
p Test.new.to_s # => "2"
clashing names, thus I cannot 'include' the modules.
Basicly what im interested in is something similar to 'using' in pascal.
Any advice would be appreciated
Q1: using ?
Q2: Is it possible to make an alias for a module, so that I for instance
only have to type X::Test when I refer to LongModuleName1::Test ?
--
Simon Strandgaard
module LongModuleName1
class Test
def to_s; "1" end
end
end
class Test
def initialize
using(LongModuleName1) { # would be nice
@value = Test.new
}
end
def to_s
@value.to_s
end
end
p Test.new.to_s # => "2"