Class: Fluent::Config::YamlParser::Loader::Visitor

Inherits:
Psych::Visitors::ToRuby
  • Object
show all
Defined in:
lib/fluent/config/yaml_parser/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(scanner, class_loader) ⇒ Visitor

Returns a new instance of Visitor.



81
82
83
# File 'lib/fluent/config/yaml_parser/loader.rb', line 81

def initialize(scanner, class_loader)
  super(scanner, class_loader)
end

Instance Method Details

#_register_domain(name, &block) ⇒ Object



85
86
87
# File 'lib/fluent/config/yaml_parser/loader.rb', line 85

def _register_domain(name, &block)
  @domain_types.merge!({ name => [name, block] })
end

#revive_hash(hash, o) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fluent/config/yaml_parser/loader.rb', line 89

def revive_hash(hash, o)
  super(hash, o).tap do |r|
    if r[SHOVEL].is_a?(Hash)
      h2 = {}
      r.each do |k, v|
        if k == SHOVEL
          h2.merge!(v)
        else
          h2[k] = v
        end
      end
      r.replace(h2)
    end
  end
end