Class: Fluent::RedisCounterOutput::RecordValueFormatter

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

Constant Summary collapse

CUSTOM_KEY_EXPRESSION_RE =
/(%_\{([^\}]+)\})/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ RecordValueFormatter

Returns a new instance of RecordValueFormatter.



82
83
84
# File 'lib/fluent/plugin/out_redis_counter.rb', line 82

def initialize(format)
  @format = format
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



81
82
83
# File 'lib/fluent/plugin/out_redis_counter.rb', line 81

def format
  @format
end

Instance Method Details

#key(record) ⇒ Object



88
89
90
91
92
# File 'lib/fluent/plugin/out_redis_counter.rb', line 88

def key(record)
  @format.gsub(CUSTOM_KEY_EXPRESSION_RE) do |s|
    record[$2]
  end
end