Class: Tpt::Rails::ApplicationEvent

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serializers::JSON
Defined in:
app/models/tpt/rails/application_event.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, metadata: {}) ⇒ ApplicationEvent

Returns a new instance of ApplicationEvent.



5
6
7
8
# File 'app/models/tpt/rails/application_event.rb', line 5

def initialize(data, metadata: {})
  @data = data || {}
  @metadata = 
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'app/models/tpt/rails/application_event.rb', line 14

def ==(other)
  @data == other.data
end

#attributesObject



18
19
20
# File 'app/models/tpt/rails/application_event.rb', line 18

def attributes
  data.merge(metadata: )
end

#event_typeObject



10
11
12
# File 'app/models/tpt/rails/application_event.rb', line 10

def event_type
  self.class.name.demodulize.gsub(/Event$/, '')
end