Module: Multiflow::Persistence
- Defined in:
- lib/multiflow/persistence.rb,
lib/multiflow/persistence/none.rb,
lib/multiflow/persistence/active_record.rb
Defined Under Namespace
Modules: ActiveRecord, None
Class Method Summary
collapse
Class Method Details
.active ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/multiflow/persistence.rb', line 3
def self.active
persistences = Array.new
Dir[File.dirname(__FILE__) + '/persistence/*.rb'].each do |file|
persistences << File.basename(file, File.extname(file)).underscore.to_sym
end
persistences
end
|
.load!(base) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/multiflow/persistence.rb', line 13
def self.load!(base)
begin
base.send :include, "Multiflow::Persistence::#{Multiflow.persistence.to_s.camelize}".constantize
rescue NameError
puts "[Multiflow] The ORM you are using does not have a Persistence layer. Defaulting to ActiveRecord."
puts "[Multiflow] You can overwrite the persistence with Multiflow.persistence = :new_persistence_layer"
Multiflow.persistence = :active_record
base.send :include, "Multiflow::Persistence::ActiveRecord".constantize
end
end
|