Module: Replication
- Defined in:
- lib/replication.rb,
lib/replication/config.rb,
lib/replication/engine.rb,
lib/replication/process.rb,
lib/replication/version.rb,
lib/replication/strand_methods.rb,
lib/replication/modules/association.rb,
lib/replication/modules/polymorphic.rb,
lib/replication/active_record/strand.rb,
lib/replication/modules/proofreading.rb,
lib/replication/modules/semi_conservative.rb,
lib/replication/active_record/polymorphic_strand.rb
Defined Under Namespace
Modules: ActiveRecord, Model, Modules, Process, StrandMethods Classes: Config, Engine, UnwoundError
Constant Summary collapse
- VERSION =
"0.4.0"
Class Method Summary collapse
- .defaults ⇒ Object
- .extended(model_class) ⇒ Object
-
.included(model_class) ⇒ Object
Include or extend it.
Class Method Details
.defaults ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/replication.rb', line 22 def self.defaults defaults = { only: [], except: [] } defaults.merge!({ strand_class: ::Replication::ActiveRecord::PolymorphicStrand, except: [:id, :created_at, :updated_at] }) if defined?(ActiveRecord) defaults end |
.extended(model_class) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/replication.rb', line 35 def self.extended(model_class) return if model_class.respond_to?(:can_replicate) model_class.class_eval do extend Process @replication_config = Class.new(Config).new(self) include Model end end |
.included(model_class) ⇒ Object
Include or extend it. We work with both.
45 46 47 |
# File 'lib/replication.rb', line 45 def self.included(model_class) model_class.extend self end |