lib/ruote/util/tree.rb in ruote-2.1.11 vs lib/ruote/util/tree.rb in ruote-2.2.0

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -26,11 +26,11 @@ module Ruote # Turning a tree into a numbered string view # # require 'ruote/util/tree' - # require 'ruote/parser/ruby_dsl' + # require 'ruote/reader/ruby_dsl' # # pdef = Ruote.process_definition :name => 'def0' do # sequence do # alpha # bravo @@ -45,10 +45,10 @@ # # 0 define {"name"=>"def0"} # # 0_0 sequence {} # # 0_0_0 alpha {} # # 0_0_1 bravo {} # - def Ruote.tree_to_s (tree, expid='0') + def Ruote.tree_to_s(tree, expid='0') d = expid.split('_').size - 1 s = "#{' ' * d * 2}#{expid} #{tree[0]} #{tree[1].inspect}\n" tree[2].each_with_index { |t, i| s << tree_to_s(t, "#{expid}_#{i}") } s