Class: HistoryBook::Event
- Inherits:
-
Object
- Object
- HistoryBook::Event
- Defined in:
- lib/history_book/event.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type, data = {}) ⇒ Event
constructor
A new instance of Event.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/history_book/event.rb', line 3 def data @data end |
#type ⇒ Object (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 |