Class: Fluent::Plugin::RedisEnrichmentFilter::CleanroomExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/filter_redis_enrichment.rb

Overview

safer object to eval code from record_transformer filter plugin

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log) ⇒ CleanroomExpander

Returns a new instance of CleanroomExpander.



292
293
294
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 292

def initialize(log)
  @log = log
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



290
291
292
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 290

def log
  @log
end

Instance Method Details

#expand(__str_to_eval__, tag: nil, time: nil, record: nil, redis: nil, **_extra) ⇒ Object



296
297
298
299
300
301
302
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 296

def expand(__str_to_eval__, tag: nil, time: nil, record: nil, redis: nil, **_extra)
  instance_eval(__str_to_eval__)
rescue NoMethodError => e
  nil
rescue StandardError => e
  log.warn("while expanding #{__str_to_eval__}: #{e}")
end