use #super from #method_missing instead of method aliasing

This commit is contained in:
Josh Holtrop 2014-03-26 11:23:32 -04:00
parent 533ee9c16c
commit 92a9982988
2 changed files with 2 additions and 4 deletions

View File

@ -246,7 +246,6 @@ module Rscons
end end
end end
alias_method :orig_method_missing, :method_missing
def method_missing(method, *args) def method_missing(method, *args)
if @builders.has_key?(method.to_s) if @builders.has_key?(method.to_s)
target, source, vars, *rest = args target, source, vars, *rest = args
@ -261,7 +260,7 @@ module Rscons
args: rest, args: rest,
} }
else else
orig_method_missing(method, *args) super
end end
end end

View File

@ -249,8 +249,7 @@ module Rscons
describe "#method_missing" do describe "#method_missing" do
it "calls the original method missing when the target method is not a known builder" do it "calls the original method missing when the target method is not a known builder" do
env = Environment.new env = Environment.new
env.should_receive(:orig_method_missing).with(:foobar) expect {env.foobar}.to raise_error /undefined method .foobar./
env.foobar
end end
it "records the target when the target method is a known builder" do it "records the target when the target method is a known builder" do