Class: TableSync::Receiving::ConfigDecorator

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
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



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/table_sync/receiving/config_decorator.rb', line 9

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

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, **additional_params, &block) ⇒ Object

rubocop:enable Metrics/ParameterLists



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

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