M
Matthew Johnson
|Well, is there anyway to turn toplevel effects on Object off? I
I would imagine something like this is being described:
def test
puts "didn't work as desired"
end
module X
def self.method_missing name, *args
# check name and require file containing the method
puts "works as desired: resending message #{name}"
end
def self.do_test
test
end
end
X.do_test
Of course if you try X.test of self.test inside of X we get "works as
desired..."
Matthew
have a
|real scenario where it causes issues.
|
| module X
| def self.method_missing( name, *args )
| if name ...
| if require 'foo'
| send( name, *args )
| ...
|
|Now if some method is defined at toplevel it can screw up my module X
|lazy loader.
Can you show me working (well, I mean non-working) example. I am not
sure how above example relates to toplevel effects.
matz.
I would imagine something like this is being described:
def test
puts "didn't work as desired"
end
module X
def self.method_missing name, *args
# check name and require file containing the method
puts "works as desired: resending message #{name}"
end
def self.do_test
test
end
end
X.do_test
Of course if you try X.test of self.test inside of X we get "works as
desired..."
Matthew