Class: TreasureData::CompactFormatYamler::Visitors::YAMLTree

Inherits:
Psych::Visitors::YAMLTree
  • Object
show all
Defined in:
lib/td/compact_format_yamler.rb

Instance Method Summary collapse

Instance Method Details

#visit_Hash(o) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/td/compact_format_yamler.rb', line 14

def visit_Hash o
  if o.class == ::Hash && o.values.all? {|v| v.kind_of?(Numeric) || v.kind_of?(String) || v.kind_of?(Symbol) }
    register(o, @emitter.start_mapping(nil, nil, true, Psych::Nodes::Mapping::FLOW))

    o.each do |k,v|
      accept k
      accept v
    end
    @emitter.end_mapping
  else
    super
  end
end