# File lib/ruote/reader/ruby_dsl.rb, line 124 def self.create_branch(name, attributes, &block) name = name[1..-1] while name[0, 1] == '_' h = attributes.each_with_object({}) { |a, h1| if a.is_a?(Hash) h1.merge!(a) else h1[a] = nil end }.remap { |(k, v), h1| k = k.is_a?(Regexp) ? k.inspect : k.to_s h1[k] = to_json(v) } c = BranchContext.new(name, h) c.instance_eval(&block) if block c.to_a end
# File lib/ruote/reader/ruby_dsl.rb, line 148 def self.to_json(v) case v when Symbol; v.to_s when Regexp; v.inspect when Array; v.collect { |e| to_json(e) } when Hash; v.remap { |(k, v), h| h[to_json(k)] = to_json(v) } when Proc; v.to_raw_source + "\n" else v end end
Generated with the Darkfish Rdoc Generator 2.