Class: RubyEventStore::ActiveRecord::WithAbstractBaseClass

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/active_record/with_abstract_base_class.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_klass) ⇒ WithAbstractBaseClass

Returns a new instance of WithAbstractBaseClass.



6
7
8
9
10
11
# File 'lib/ruby_event_store/active_record/with_abstract_base_class.rb', line 6

def initialize(base_klass)
  unless base_klass < ::ActiveRecord::Base && base_klass.abstract_class?
    raise ArgumentError.new("#{base_klass} must be an abstract class that inherits from ActiveRecord::Base")
  end
  @base_klass = base_klass
end

Instance Method Details

#call(instance_id: SecureRandom.hex) ⇒ Object



13
14
15
# File 'lib/ruby_event_store/active_record/with_abstract_base_class.rb', line 13

def call(instance_id: SecureRandom.hex)
  [build_event_klass(instance_id), build_stream_klass(instance_id)]
end