class LogStash::Filters::Dictionary::YamlFile

Protected Instance Methods

initialize_for_file_type(**file_type_args) click to toggle source
# File lib/logstash/filters/dictionary/yaml_file.rb, line 10
def initialize_for_file_type(**file_type_args)
  @visitor = YamlVisitor.create

  @parser = Psych::Parser.new(Psych::TreeBuilder.new)
  @parser.code_point_limit = file_type_args[:yaml_code_point_limit]
end
read_file_into_dictionary() click to toggle source
# File lib/logstash/filters/dictionary/yaml_file.rb, line 17
def read_file_into_dictionary
  # low level YAML read that tries to create as
  # few intermediate objects as possible
  # this overwrites the value at key
  yaml_string = IO.read(@dictionary_path, :mode => 'r:bom|utf-8')
  @parser.parse(yaml_string, @dictionary_path)
  @visitor.accept_with_dictionary(@dictionary, @parser.handler.root)
end