Class: UCD::AttributeParser

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/ucd/attribute_parser.rb

Defined Under Namespace

Classes: Transform

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(io, options = {}) ⇒ Object



12
13
14
# File 'lib/ucd/attribute_parser.rb', line 12

def self.parse(io, options={})
  new.parse(io, options)
end

Instance Method Details

#parse(io, options = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/ucd/attribute_parser.rb', line 16

def parse(io, options={})
  tree = Transform.new.apply(super)
  tree = tree[:assignments].each_with_object({}) { |assignment, memo| memo[assignment[:name].to_s] = assignment[:value] }

  tree
end