Module: ActiveEvent::EventType

Extended by:
ActiveSupport::Concern
Includes:
Support::AttrInitializer
Defined in:
lib/active_event/event_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::AttrInitializer

#attributes_except, #freeze, #initialize, #to_hash

Instance Attribute Details

#store_infosObject



21
22
23
# File 'lib/active_event/event_type.rb', line 21

def store_infos
  @store_infos ||= {}
end

Class Method Details

.create_instance(type, data) ⇒ Object



10
11
12
13
14
15
# File 'lib/active_event/event_type.rb', line 10

def self.create_instance(type, data)
  Object.const_get(type).new(data)
rescue NameError
  require 'ostruct'
  OpenStruct.new(data.merge(event_type: type.to_s)).freeze
end

Instance Method Details

#add_store_infos(hash) ⇒ Object



17
18
19
# File 'lib/active_event/event_type.rb', line 17

def add_store_infos(hash)
  store_infos.merge! hash
end

#event_typeObject



6
7
8
# File 'lib/active_event/event_type.rb', line 6

def event_type
  self.class.name
end