Sha256: f107d12147170c9b715d3a4fe938710502db7f88cbebd9d3dac1b0fb92b47929
Contents?: true
Size: 708 Bytes
Versions: 20
Compression:
Stored size: 708 Bytes
Contents
# frozen_string_literal: true module TableSync::Receiving 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: nil, to_model: nil, events: [:update, :destroy], &block) model = to_table ? TableSync.receiving_model.new(to_table) : to_model TableSync::Utils::InterfaceChecker.new(model).implements(:receiving_model) config = ::TableSync::Receiving::Config.new(model: model, events: events) config.instance_exec(&block) if block configs[source.to_s] << config self end end end
Version data entries
20 entries across 20 versions & 1 rubygems