Class: Akasha::Event
- Inherits:
-
Object
- Object
- Akasha::Event
- Defined in:
- lib/akasha/event.rb
Overview
Describes a single event recorded by the system.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, id = nil, metadata = {}, **data) ⇒ Event
constructor
A new instance of Event.
- #with_metadata(metadata) ⇒ Object
Constructor Details
#initialize(name, id = nil, metadata = {}, **data) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 |
# File 'lib/akasha/event.rb', line 9 def initialize(name, id = nil, = {}, **data) @id = id || SecureRandom.uuid.to_s # TODO: Use something better. @name = name @metadata = || { created_at: Time.now.utc } @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/akasha/event.rb', line 7 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/akasha/event.rb', line 7 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/akasha/event.rb', line 7 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/akasha/event.rb', line 7 def name @name end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/akasha/event.rb', line 16 def ==(other) self.class == other.class && id == other.id && name == other.name && data == other.data && == other. end |