lib/fluent/plugin/out_simple_arithmetic.rb in fluent-plugin-simplearithmetic-0.0.1 vs lib/fluent/plugin/out_simple_arithmetic.rb in fluent-plugin-simplearithmetic-0.0.2
- old
+ new
@@ -11,10 +11,11 @@
# 'nil', 'undefined', 'error_string'
config_param :how_to_process_error, :string, :default => 'error_string'
config_param :replace_hyphen, :string, :default => '__HYPHON__'
config_param :replace_dollar, :string, :default => '__DOLLAR__'
+ config_param :replace_at, :string, :default => '__AT__'
attr_accessor :_formulas
def initialize
super
@@ -89,20 +90,20 @@
# functions for symbols
def replace_symbols(record)
# 'var-1' -> 'var__HYPHEN__1'
new_record = {}
record.each_pair {|key, value|
- new_key = key.gsub('-', @replace_hyphen).gsub('$', @replace_dollar)
+ new_key = key.gsub('-', @replace_hyphen).gsub('$', @replace_dollar).gsub('@', @replace_at)
new_record[new_key] = value
}
return new_record
end
def restore_symbols(record)
# 'var__HYPHEN__1' -> 'var-1'
new_record = {}
record.each_pair {|key, value|
- new_key = key.gsub(@replace_hyphen, '-').gsub(@replace_dollar, '$')
+ new_key = key.gsub(@replace_hyphen, '-').gsub(@replace_dollar, '$').gsub(@replace_at, '@')
new_record[new_key] = value
}
new_record
end