class Akasha::Event
Describes a single event recorded by the system.
Attributes
data[R]
id[R]
metadata[R]
name[R]
Public Class Methods
new(name, id = nil, metadata = {}, **data)
click to toggle source
# File lib/akasha/event.rb, line 9 def initialize(name, id = nil, metadata = {}, **data) @id = id || SecureRandom.uuid.to_s # TODO: Use something better. @name = name @metadata = metadata || { created_at: Time.now.utc } @data = data end
Public Instance Methods
==(other)
click to toggle source
# File lib/akasha/event.rb, line 16 def ==(other) self.class == other.class && id == other.id && name == other.name && data == other.data && metadata == other.metadata end
with_metadata(metadata)
click to toggle source
# File lib/akasha/event.rb, line 24 def with_metadata(metadata) Event.new(@name, @id, @metadata.merge(metadata), **@data) end