lib/ruote/parser/ruby_dsl.rb in ruote-2.1.10 vs lib/ruote/parser/ruby_dsl.rb in ruote-2.1.11
- old
+ new
@@ -20,11 +20,13 @@
# THE SOFTWARE.
#
# Made in Japan.
#++
+require 'ruote/util/ometa'
+
module Ruote
# Not really a parser, more an AST builder.
#
# pdef = Ruote.define :name => 'take_out_garbage' do
@@ -92,11 +94,11 @@
# :nodoc:
#
module RubyDsl
- class BranchContext
+ class BranchContext < Ruote::BlankSlate
def initialize (name, attributes)
@name = name
@attributes = attributes
@@ -115,12 +117,10 @@
end
end
def self.create_branch (name, attributes, &block)
- while name[0, 1] == '_'
- name = name[1..-1]
- end
+ name = name[1..-1] while name[0, 1] == '_'
h = attributes.inject({}) { |h1, a|
a.is_a?(Hash) ? h1.merge!(a) : h1[a] = nil
h1
}.inject({}) { |h1, (k, v)|