Class: LogStash::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/devutils/rspec/spec_helper.rb

Overview

ugly, I know, but this avoids adding conditionals in performance critical section

Instance Method Summary collapse

Instance Method Details

#[]=(str, value) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/logstash/devutils/rspec/spec_helper.rb', line 39

def []=(str, value)
  if str == TIMESTAMP && !value.is_a?(LogStash::Timestamp)
    raise TypeError, "The field '@timestamp' must be a LogStash::Timestamp, not a #{value.class} (#{value})"
  end
  LogStash::Event.validate_value(value)
  setval(str, value)
end

#setvalObject



38
# File 'lib/logstash/devutils/rspec/spec_helper.rb', line 38

alias_method :setval, :[]=