Class: TableSync::Receiving::ConfigDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/table_sync/receiving/config_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:, event:, model:, version:, project_id:, raw_data:) ⇒ ConfigDecorator

rubocop:disable Metrics/ParameterLists



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/table_sync/receiving/config_decorator.rb', line 6

def initialize(config:, event:, model:, version:, project_id:, raw_data:)
  @config = config

  @default_params = {
    event:,
    model:,
    version:,
    project_id:,
    raw_data:,
  }
end

Instance Method Details

#allow_event?(name) ⇒ Boolean



28
29
30
# File 'lib/table_sync/receiving/config_decorator.rb', line 28

def allow_event?(name)
  @config.allow_event?(name)
end

#modelObject



24
25
26
# File 'lib/table_sync/receiving/config_decorator.rb', line 24

def model
  @config.model
end

#option(name, **additional_params) ⇒ Object

rubocop:enable Metrics/ParameterLists



19
20
21
22
# File 'lib/table_sync/receiving/config_decorator.rb', line 19

def option(name, **additional_params, &)
  value = @config.option(name)
  value.is_a?(Proc) ? value.call(@default_params.merge(additional_params), &) : value
end