Sha256: d93fac6eaa5a171873037a87e5fe28ab137844816915cbd181fb21c68af6d326
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
module Multiflow module Persistence 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 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 Multiflow::Persistence.active.each do |p| autoload p.to_s.camelize.to_sym, "multiflow/persistence/#{p.to_s}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
multiflow-1.0.0 | lib/multiflow/persistence.rb |