lib/erbook/document.rb in erbook-7.1.1 vs lib/erbook/document.rb in erbook-7.3.0

- old
+ new

@@ -73,33 +73,31 @@ :@nodes => @nodes = [], # all nodes in the forest :@nodes_by_type => @nodes_by_type = Hash.new {|h,k| h[k] = [] }, :@stack => [], # stack for all nodes }.each_pair {|k,v| sandbox.instance_variable_set(k, v) } + #:stopdoc: + ## # Handles the method call from a node # placeholder in the input document. # def sandbox.__node_impl__ node_type, *node_args, &node_content node = Node.new( - :type => node_type, - :defn => @format['nodes'][node_type], - :args => node_args, - :children => [], - - # omit erbook internals from the stack trace - :trace => caller.reject {|t| - [$0, ERBook::INSTALL].any? {|f| t.index(f) == 0 } - } + :type => node_type, + :defn => @format['nodes'][node_type], + :args => node_args, + :trace => caller, + :children => [] ) @nodes << node @nodes_by_type[node.type] << node # calculate occurrence number for this node if node.defn['number'] - @count ||= Hash.new {|h,k| h[k] = []} - node.number = (@count[node.type] << node).length + @count_by_type ||= Hash.new {|h,k| h[k] = 0 } + node.number = (@count_by_type[node.type] += 1) end # assign node family if parent = @stack.last parent.children << node @@ -135,9 +133,11 @@ @buffer << node nil end + + #:startdoc: @node_defs.each_key do |type| # XXX: using a string because define_method() # does not accept a block until Ruby 1.9 file, line = __FILE__, __LINE__; eval %{