Class: Psych::Visitors::YAMLTree

Inherits:
Object
  • Object
show all
Defined in:
lib/alf/ext/yaml.rb

Instance Method Summary collapse

Instance Method Details

#visit_Alf_Relation(o) ⇒ Object


14
15
16
17
18
# File 'lib/alf/ext/yaml.rb', line 14

def visit_Alf_Relation o
  @emitter.start_sequence(nil, nil, true, Nodes::Sequence::BLOCK)
  o.each { |c| accept c }
  @emitter.end_sequence
end

#visit_Alf_Renderer_YAML(o) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/alf/ext/yaml.rb', line 20

def visit_Alf_Renderer_YAML o
  @emitter.start_sequence(nil, nil, true, Nodes::Sequence::BLOCK)
  o.input.each{|tuple|
    @emitter.start_mapping(nil, nil, true, Psych::Nodes::Mapping::BLOCK)
    tuple.to_hash.each do |k,v|
      accept k.to_s
      accept v
    end
    @emitter.end_mapping
  }
  @emitter.end_sequence
end

#visit_Alf_Tuple(o) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/alf/ext/yaml.rb', line 5

def visit_Alf_Tuple o
  @emitter.start_mapping(nil, nil, true, Psych::Nodes::Mapping::BLOCK)
  o.to_hash.each do |k,v|
    accept k.to_s
    accept v
  end
  @emitter.end_mapping
end