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.



64
65
66
# File 'lib/fluent/config/yaml_parser/loader.rb', line 64

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

Instance Method Details

#_register_domain(name, &block) ⇒ Object



68
69
70
# File 'lib/fluent/config/yaml_parser/loader.rb', line 68

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

#revive_hash(hash, o) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fluent/config/yaml_parser/loader.rb', line 72

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