Class: LogStash::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/event.rb

Constant Summary collapse

MSG_BRACKETS_METHOD_MISSING =
"Direct event field references (i.e. event['field']) have been disabled in favor of using event get and set methods (e.g. event.get('field')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
MSG_BRACKETS_EQUALS_METHOD_MISSING =
"Direct event field references (i.e. event['field'] = 'value') have been disabled in favor of using event get and set methods (e.g. event.set('field', 'value')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
RE_BRACKETS_METHOD =
/^\[\]$/.freeze
RE_BRACKETS_EQUALS_METHOD =
/^\[\]=$/.freeze

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/logstash/event.rb', line 41

def method_missing(method_name, *arguments, &block)
  if RE_BRACKETS_METHOD.match(method_name.to_s)
    raise NoMethodError.new(MSG_BRACKETS_METHOD_MISSING)
  end
  if RE_BRACKETS_EQUALS_METHOD.match(method_name.to_s)
    raise NoMethodError.new(MSG_BRACKETS_EQUALS_METHOD_MISSING)
  end
  super
end