Module: Replication::Process
- Defined in:
- lib/replication/process.rb
Instance Method Summary collapse
- #can_replicate(pairs_method = :attributes, **options) ⇒ Object
- #new_from_strand(id = nil, **options) ⇒ Object
- #replication_config ⇒ Object
- #reset_config ⇒ Object
Instance Method Details
#can_replicate(pairs_method = :attributes, **options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/replication/process.rb', line 4 def can_replicate(pairs_method = :attributes, **) reset_config if self.respond_to?(:unwound) puts replication_config.inspect = 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 include Model end |
#new_from_strand(id = nil, **options) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/replication/process.rb', line 20 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
34 35 36 37 38 |
# File 'lib/replication/process.rb', line 34 def replication_config @replication_config ||= base_class.replication_config.dup.tap do |config| config.model_class = self end end |
#reset_config ⇒ Object
30 31 32 |
# File 'lib/replication/process.rb', line 30 def reset_config @replication_config = nil end |