class LogStash::Filters::FetchStrategy::File::RegexUnion

Public Class Methods

new(dictionary, rw_lock) click to toggle source
# File lib/logstash/filters/fetch_strategy/file.rb, line 58
def initialize(dictionary, rw_lock)
  @dictionary = dictionary
  @read_lock = rw_lock.readLock
end

Public Instance Methods

dictionary_updated() click to toggle source
# File lib/logstash/filters/fetch_strategy/file.rb, line 63
def dictionary_updated
  @union_regex_keys = Regexp.union(@dictionary.keys)
end
fetch(source, results) click to toggle source
# File lib/logstash/filters/fetch_strategy/file.rb, line 67
def fetch(source, results)
  @read_lock.lock
  begin
    value = source.gsub(@union_regex_keys, @dictionary)
    if source == value
      results[0] = false
    else
      results[1] = LogStash::Util.deep_clone(value)
    end
  ensure
    @read_lock.unlock
  end
end