lib/nm/template.rb in nm-0.5.3 vs lib/nm/template.rb in nm-0.5.4

- old
+ new

@@ -4,11 +4,11 @@ module Nm class Template def initialize(*args) - @__dstack__ = [ nil ] + @__dstack__ = [nil] # apply any given locals to template scope as methods metaclass = class << self; self; end metaclass.class_eval do (args.last.kind_of?(::Hash) ? args.pop : {}).each do |key, value| @@ -32,10 +32,10 @@ " @__source__.root=#{@__source__.root.to_s.inspect}"\ " __data__=#{self.__data__.inspect}>" end def __data__ - @__dstack__.last + @__dstack__.last || ::Hash.new end def __node__(key, value = nil, &block) unless @__dstack__[-1].nil? || @__dstack__[-1].is_a?(::Hash) raise Nm::InvalidError, "invalid `node` call"