Permalink
Browse files

gotta rescue from invalid ivar names

  • Loading branch information...
1 parent 61ead8e commit 6b1daf54f07a6672e117354f9ad9c68e8bea5442 Sven Fuchs committed Sep 12, 2010
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/minimal/template.rb
View
@@ -40,9 +40,14 @@ def respond_to?(method)
protected
def method_missing(method, *args, &block)
- locals.key?(method) ? locals[method] :
- view.instance_variable_defined?("@#{method}") && !SKIP_IVARS.include?(method) ? view.instance_variable_get("@#{method}") :
- view.respond_to?(method) ? call_view(method, *args, &block) : super
+ return locals[method] if locals.key?(method)
+ return view.instance_variable_get("@#{method}") if ivar?(method)
+ return call_view(method, *args, &block) if view.respond_to?(method)
+ super
+ end
+
+ def ivar?(method)
+ !SKIP_IVARS.include?(method) && view.instance_variable_defined?("@#{method}") rescue false
end
def call_view(method, *args, &block)

0 comments on commit 6b1daf5

Please sign in to comment.