Sha256: b59dc74b3053312676b7406c2f466e4addf3fefa8d723d883281f1a268fb546a

Contents?: true

Size: 533 Bytes

Versions: 16

Compression:

Stored size: 533 Bytes

Contents

# frozen_string_literal: true

module TableSync
  module DSL
    def inherited(klass)
      klass.instance_variable_set(:@configs, configs.deep_dup)
      super
    end

    def configs
      @configs ||= Hash.new { |hash, key| hash[key] = [] }
    end

    def receive(source, to_table:, events: nil, &block)
      config = ::TableSync::Config.new(
        model: TableSync.orm.model.new(to_table),
        events: events,
      )

      config.instance_exec(&block) if block

      configs[source.to_s] << config
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
table_sync-2.3.0 lib/table_sync/dsl.rb
table_sync-2.2.0 lib/table_sync/dsl.rb
table_sync-2.1.0 lib/table_sync/dsl.rb
table_sync-2.0.0 lib/table_sync/dsl.rb
table_sync-1.13.1 lib/table_sync/dsl.rb
table_sync-1.13.0 lib/table_sync/dsl.rb
table_sync-1.12.1 lib/table_sync/dsl.rb
table_sync-1.12.0 lib/table_sync/dsl.rb
table_sync-1.11.0 lib/table_sync/dsl.rb
table_sync-1.10.0 lib/table_sync/dsl.rb
table_sync-1.9.0 lib/table_sync/dsl.rb
table_sync-1.8.0 lib/table_sync/dsl.rb
table_sync-1.7.0 lib/table_sync/dsl.rb
table_sync-1.6.0 lib/table_sync/dsl.rb
table_sync-1.5.0 lib/table_sync/dsl.rb
table_sync-1.4.0 lib/table_sync/dsl.rb