Class: HistoryBook::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/history_book/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, data = {}) ⇒ Event

Returns a new instance of Event.



5
6
7
8
# File 'lib/history_book/event.rb', line 5

def initialize(type, data = {})
  @type = type
  @data = data.with_indifferent_access
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/history_book/event.rb', line 3

def data
  @data
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/history_book/event.rb', line 3

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/history_book/event.rb', line 10

def ==(other)
  self.type == other.type && self.data == other.data
end