lib/petroglyph/scope.rb in petroglyph-0.0.1 vs lib/petroglyph/scope.rb in petroglyph-0.0.2

- old
+ new

@@ -3,10 +3,11 @@ attr_accessor :value, :object, :file def initialize(context = nil, locals = {}, template_filename = nil, parent_scope = nil) @file = template_filename @context = context + self.copy_instance_variables_from(@context, [:@assigns, :@helpers]) if self.respond_to?(:copy_instance_variables_from) @locals = locals @parent_scope = parent_scope @value = nil end @@ -79,10 +80,10 @@ scope.instance_eval(data) merge scope.value end def method_missing(method, *args, &block) - if @locals.has_key?(method) + if @locals and @locals.has_key?(method) @locals[method] elsif @context.respond_to?(method) @context.send(method) else super