Class: Aikido::Zen::Event
- Inherits:
-
Object
- Object
- Aikido::Zen::Event
- Defined in:
- lib/aikido/zen/event.rb
Overview
Base class for all events. You should be using one of the subclasses defined in the Events module.
Direct Known Subclasses
Aikido::Zen::Events::Attack, Aikido::Zen::Events::Heartbeat, Aikido::Zen::Events::Started
Instance Attribute Summary collapse
-
#system_info ⇒ Object
readonly
Returns the value of attribute system_info.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(type:, system_info: Aikido::Zen.system_info, time: Time.now.utc) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(type:, system_info: Aikido::Zen.system_info, time: Time.now.utc) ⇒ Event
Returns a new instance of Event.
11 12 13 14 15 |
# File 'lib/aikido/zen/event.rb', line 11 def initialize(type:, system_info: Aikido::Zen.system_info, time: Time.now.utc) @type = type @time = time @system_info = system_info end |
Instance Attribute Details
#system_info ⇒ Object (readonly)
Returns the value of attribute system_info.
9 10 11 |
# File 'lib/aikido/zen/event.rb', line 9 def system_info @system_info end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/aikido/zen/event.rb', line 8 def time @time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/aikido/zen/event.rb', line 7 def type @type end |
Instance Method Details
#as_json ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/aikido/zen/event.rb', line 17 def as_json { type: type, time: time.to_i * 1000, agent: system_info.as_json } end |