A
Ara.T.Howard
any idea if this behaviour is intended or not?
mussel:~/eg/ruby/nrtlib/nrtlib-0.0.0 > cat a.rb
#
# the problem
#
module NRT
class Subscription
def process_incoming
raise NotImplementedError
end
alias_method "run", "process_incoming"
end
class OLSSubscription < Subscription
def process_incoming
p 42
end
end
end
begin; NRT::OLSSubscription::new.run ;rescue Exception => e; p e; end
#
# an easy solution
#
module NRT
class Subscription
def self::anonym dst, src
module_eval %Q[ def #{ dst }(*a, &b) #{ src }(*a, &b) end ]
end
anonym "run", "process_incoming"
end
end
NRT::OLSSubscription::new.run
mussel:~/eg/ruby/nrtlib/nrtlib-0.0.0 > ruby a.rb
#<NotImplementedError: NotImplementedError>
42
this seems odd to me.
-a
mussel:~/eg/ruby/nrtlib/nrtlib-0.0.0 > cat a.rb
#
# the problem
#
module NRT
class Subscription
def process_incoming
raise NotImplementedError
end
alias_method "run", "process_incoming"
end
class OLSSubscription < Subscription
def process_incoming
p 42
end
end
end
begin; NRT::OLSSubscription::new.run ;rescue Exception => e; p e; end
#
# an easy solution
#
module NRT
class Subscription
def self::anonym dst, src
module_eval %Q[ def #{ dst }(*a, &b) #{ src }(*a, &b) end ]
end
anonym "run", "process_incoming"
end
end
NRT::OLSSubscription::new.run
mussel:~/eg/ruby/nrtlib/nrtlib-0.0.0 > ruby a.rb
#<NotImplementedError: NotImplementedError>
42
this seems odd to me.
-a