Sha256: c216fc3851dbc9f5d861099ee48044119929a5eebb0943852f66c410c300c4fe

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/hash/slice'

module Replication
  module Modules
    module SemiConservative

      def unwound(**options)
        strand_class.new({
          name: options[:name],
          pairs: strand_attributes,
          origin_id: self.id,
          origin_type: self.class.to_s
        })
      end

      def replicate(**options)
        strand_class.to_adapter.create!({
          name: options[:name],
          pairs: strand_attributes,
          origin_id: self.id,
          origin_type: self.class.to_s
        })
      end

      def strand_attributes
        @strand_attributes = _strand_attributes
        @strand_attributes = @strand_attributes.slice(*replication_config.only) unless replication_config.only.empty?
        @strand_attributes = @strand_attributes.except(*replication_config.except) unless replication_config.except.empty?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
replication-0.4.1 lib/replication/modules/semi_conservative.rb
replication-0.4.0 lib/replication/modules/semi_conservative.rb