Class: AasmHistory::PersistanceDeterminator

Inherits:
Object
  • Object
show all
Defined in:
lib/aasm_history/persistance_determinator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ PersistanceDeterminator

Returns a new instance of PersistanceDeterminator.



9
10
11
# File 'lib/aasm_history/persistance_determinator.rb', line 9

def initialize base
  @base = base
end

Class Method Details

.determine(base) ⇒ Object



21
22
23
# File 'lib/aasm_history/persistance_determinator.rb', line 21

def self.determine base
  new(base).determine
end

Instance Method Details

#determineObject



13
14
15
16
17
18
19
# File 'lib/aasm_history/persistance_determinator.rb', line 13

def determine
  hierarchy = @base.ancestors.map {|klass| klass.to_s}

  if hierarchy.include?('ActiveRecord::Base')
    :active_record
  end
end