Class: Ductr::ETL::Control

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ductr/etl/controls/control.rb

Overview

Base class for all types of ETL control.

Direct Known Subclasses

Destination, Source, Transform

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job_method, adapter = nil, **options) ⇒ Control

Creates a new control based on the job instance and the configured adapter.

Parameters:

  • job_method (Method)

    The job’s method to be called by the control

  • adapter (Adapter) (defaults to: nil)

    The configured adapter

  • **options (Hash)

    The configuration hash of the control’s adapter



39
40
41
42
43
# File 'lib/ductr/etl/controls/control.rb', line 39

def initialize(job_method, adapter = nil, **options)
  @job_method = job_method
  @adapter = adapter
  @options = options
end

Class Attribute Details

.typeSymbol

Returns The control type, written when registering the control into its adapter.

Returns:

  • (Symbol)

    The control type, written when registering the control into its adapter



13
14
15
# File 'lib/ductr/etl/controls/control.rb', line 13

def type
  @type
end

Instance Attribute Details

#adapterAdapter (readonly)

Returns The control’s adapter.

Returns:

  • (Adapter)

    The control’s adapter



30
31
32
# File 'lib/ductr/etl/controls/control.rb', line 30

def adapter
  @adapter
end

#job_methodSymbol (readonly)

Returns The method to be called by the control.

Returns:

  • (Symbol)

    The method to be called by the control



24
25
26
# File 'lib/ductr/etl/controls/control.rb', line 24

def job_method
  @job_method
end

#optionsHash (readonly)

Returns The configuration hash of the control’s adapter.

Returns:

  • (Hash)

    The configuration hash of the control’s adapter



27
28
29
# File 'lib/ductr/etl/controls/control.rb', line 27

def options
  @options
end

Instance Method Details

#call_methodObject

Invokes the job’s method linked to the control.

Returns:

  • (Object)

    Something returned by the method, e.g. a query, a file, a row, …



21
# File 'lib/ductr/etl/controls/control.rb', line 21

def_delegator :@job_method, :call, :call_method