lib/veil.rb in veils-0.1.0 vs lib/veil.rb in veils-0.1.1
- old
+ new
@@ -47,25 +47,23 @@
method_missing(:to_json, options)
end
def method_missing(*args)
method = args[0]
- if @pierced
+ if @pierced || !@methods.key?(method)
+ @pierced = true
unless @origin.respond_to?(method)
raise "Method #{method} is absent in #{@origin}"
end
if block_given?
@origin.__send__(*args) do |*a|
yield(*a)
end
else
@origin.__send__(*args)
end
- elsif @methods.key?(method)
- @methods[method]
else
- @pierced = true
- method_missing(*args)
+ @methods[method]
end
end
def respond_to?(method, include_private = false)
@origin.respond_to?(method, include_private) || @methods[method]