Module: Replication::Process
- Defined in:
- lib/replication/process.rb
Defined Under Namespace
Modules: Model
Class Method Summary collapse
- .extended(model_class) ⇒ Object
-
.included(model_class) ⇒ Object
Include or extend it.
Instance Method Summary collapse
- #can_replicate(pairs_method = :attributes, **options) ⇒ Object
- #new_from_strand(id = nil, **options) ⇒ Object
- #replication_config ⇒ Object
Class Method Details
.extended(model_class) ⇒ Object
4 5 6 7 8 |
# File 'lib/replication/process.rb', line 4 def self.extended(model_class) model_class.class_eval do include Model end end |
.included(model_class) ⇒ Object
Include or extend it. We work with both.
11 12 13 |
# File 'lib/replication/process.rb', line 11 def self.included(model_class) model_class.extend self end |
Instance Method Details
#can_replicate(pairs_method = :attributes, **options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/replication/process.rb', line 15 def can_replicate(pairs_method = :attributes, **) @@replication_config = Class.new(Config).new(self) = Replication.defaults modules = [:semi_conservative] # required module modules.concat([].push(.delete(:with)).flatten).compact! @@replication_config.pairs_method = pairs_method @@replication_config.set .merge() @@replication_config.with modules end |
#new_from_strand(id = nil, **options) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/replication/process.rb', line 26 def new_from_strand(id=nil, **) if id strand = replication_config.strand_class.to_adapter.get!(id) else strand = replication_config.strand_class.to_adapter.find_first() end new(strand.pairs) if strand end |
#replication_config ⇒ Object
36 37 38 |
# File 'lib/replication/process.rb', line 36 def replication_config @@replication_config end |