Class: Jac::Parser::VisitorToRuby
- Inherits:
-
Psych::Visitors::ToRuby
- Object
- Psych::Visitors::ToRuby
- Jac::Parser::VisitorToRuby
- Defined in:
- lib/jac/parser.rb
Overview
Cutstom Yaml AST visitor While standart Psych visitor converts sets to ‘{ value => nil }` mappings we need explicitly convert those mappings to ruby Set
Instance Method Summary collapse
-
#visit_Psych_Nodes_Mapping(o) ⇒ Object
Uses standard Psych visitor to convert mapping to ruby object except ‘!set` case.
Instance Method Details
#visit_Psych_Nodes_Mapping(o) ⇒ Object
Uses standard Psych visitor to convert mapping to ruby object except ‘!set` case. Here we convert mapping to Set.
17 18 19 20 21 22 23 24 |
# File 'lib/jac/parser.rb', line 17 def visit_Psych_Nodes_Mapping(o) case o.tag when '!set', 'tag:yaml.org,2002:set' visit_set(o) else # fallback to default implementation super(o) end end |