Class: FluQ::Event
- Inherits:
-
Hash
- Object
- Hash
- FluQ::Event
- Defined in:
- lib/fluq/event.rb
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
True if comparable.
-
#initialize(record = {}, timestamp = Time.now) ⇒ Event
constructor
A new instance of Event.
-
#inspect ⇒ String
Inspection.
-
#time ⇒ Time
UTC time.
Constructor Details
#initialize(record = {}, timestamp = Time.now) ⇒ Event
Returns a new instance of Event.
8 9 10 11 12 13 |
# File 'lib/fluq/event.rb', line 8 def initialize(record = {}, = Time.now) @timestamp = .to_i @meta = {} super() update(record) if Hash === record end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
4 5 6 |
# File 'lib/fluq/event.rb', line 4 def @meta end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
3 4 5 |
# File 'lib/fluq/event.rb', line 3 def @timestamp end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Returns true if comparable.
21 22 23 24 25 26 27 28 |
# File 'lib/fluq/event.rb', line 21 def ==(other) case other when FluQ::Event super && other. == else super end end |
#inspect ⇒ String
Returns inspection.
32 33 34 |
# File 'lib/fluq/event.rb', line 32 def inspect "#<FluQ::Event(#{}) data:#{super} meta:#{.inspect}>" end |
#time ⇒ Time
Returns UTC time.
16 17 18 |
# File 'lib/fluq/event.rb', line 16 def time @time ||= Time.at().utc end |