lib/petroglyph/scope.rb in petroglyph-0.0.3 vs lib/petroglyph/scope.rb in petroglyph-0.0.4
- old
+ new
@@ -79,17 +79,27 @@
scope = Scope.new(@context, locals, file)
scope.instance_eval(data.to_s)
merge scope.value
end
+ def respond_to?(method)
+ super || local?(method)
+ end
+
def method_missing(method, *args, &block)
- if @locals and @locals.has_key?(method)
+ if local?(method)
@locals[method]
elsif @context.respond_to?(method)
@context.send(method, *args)
else
super
end
+ end
+
+ private
+
+ def local?(method)
+ @locals and @locals.has_key?(method)
end
end
end