class LogStash::Filters::FetchStrategy::Memory::ExactRegex
Public Class Methods
new(dictionary)
click to toggle source
# File lib/logstash/filters/fetch_strategy/memory.rb, line 19 def initialize(dictionary) @keys_regex = Hash.new() @dictionary = dictionary @dictionary.keys.each{|k| @keys_regex[k] = Regexp.new(k)} end
Public Instance Methods
fetch(source, results)
click to toggle source
# File lib/logstash/filters/fetch_strategy/memory.rb, line 25 def fetch(source, results) key = @dictionary.keys.detect{|k| source.match(@keys_regex[k])} if key.nil? results[0] = false else results[1] = LogStash::Util.deep_clone(@dictionary[key]) end end