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.



371
372
373
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 371

def initialize(log)
  @log = log
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



369
370
371
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 369

def log
  @log
end

Instance Method Details

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



375
376
377
378
379
380
381
382
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 375

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}")
  nil
end