Sha256: f6e2b773aa0a6efe2da71369d4119ae4d988e9a5a4562ec3913e9144b0b35302

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

require "memery"
require "self_data"
require "rabbit_messaging"
require "rabbit/event_handler" # NOTE: from rabbit_messaging"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/numeric/time"

module TableSync
  require_relative "table_sync/utils"
  require_relative "table_sync/version"
  require_relative "table_sync/errors"
  require_relative "table_sync/instrument"
  require_relative "table_sync/instrument_adapter/active_support"
  require_relative "table_sync/naming_resolver/active_record"
  require_relative "table_sync/naming_resolver/sequel"
  require_relative "table_sync/receiving"
  require_relative "table_sync/publishing"

  class << self
    attr_accessor :publishing_job_class_callable
    attr_accessor :batch_publishing_job_class_callable
    attr_accessor :routing_key_callable
    attr_accessor :exchange_name
    attr_accessor :routing_metadata_callable
    attr_accessor :notifier
    attr_reader :orm
    attr_reader :publishing_adapter
    attr_reader :receiving_model

    def sync(klass, **opts)
      publishing_adapter.setup_sync(klass, opts)
    end

    def orm=(val)
      case val
      when :active_record
        @publishing_adapter = Publishing::ORMAdapter::ActiveRecord
        @receiving_model = Receiving::Model::ActiveRecord
      when :sequel
        @publishing_adapter = Publishing::ORMAdapter::Sequel
        @receiving_model = Receiving::Model::Sequel
      else
        raise ORMNotSupported.new(val.inspect)
      end

      @orm = val
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
table_sync-5.1.0 lib/table_sync.rb
table_sync-5.0.0 lib/table_sync.rb
table_sync-4.2.2 lib/table_sync.rb
table_sync-4.2.1 lib/table_sync.rb
table_sync-4.2.0 lib/table_sync.rb
table_sync-4.1.3 lib/table_sync.rb
table_sync-4.1.1 lib/table_sync.rb
table_sync-4.1.0 lib/table_sync.rb
table_sync-4.0.0 lib/table_sync.rb