Sha256: 9e46739328d0a8f72c09441dcfd49bd2b46e67e8d072714c70b7760c25afcddf
Contents?: true
Size: 722 Bytes
Versions: 6
Compression:
Stored size: 722 Bytes
Contents
class HumansRb class Transform < Parslet::Transform rule(:sections => subtree(:sections)) do |dict| dict[:sections].reduce(Hash.new, :merge) end rule(:heading => simple(:heading), :values => subtree(:values)) do |dict| { dict[:heading].to_s.downcase.to_sym => dict[:values].reduce(Hash.new, :merge) } end rule(:heading => simple(:heading), :members => subtree(:values)) do |dict| { dict[:heading].to_s.downcase.to_sym => dict[:values] } end rule(:member => subtree(:member)) do |dict| dict[:member].reduce(Hash.new, :merge) end rule(:key => simple(:key), :value => subtree(:value)) do { key.to_s.downcase.to_sym => value.to_s } end end end
Version data entries
6 entries across 6 versions & 1 rubygems