Class: Ductr::ETL::FiberControl

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

Overview

Glues ETL controls and the associated fibers together.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(control, type:) ⇒ FiberControl

Creates a new fiber control with the given control and control type.

Parameters:

  • control (Control)

    The ETL control to work with in the fiber

  • type (Symbol)

    The ETL control type, one of [:source, :transform, :destination]



29
30
31
32
33
34
# File 'lib/ductr/etl/fiber_control.rb', line 29

def initialize(control, type:)
  @control = control
  @type = type

  @right = []
end

Instance Attribute Details

#controlControl (readonly)

Returns The ETL control instance.

Returns:

  • (Control)

    The ETL control instance



21
22
23
# File 'lib/ductr/etl/fiber_control.rb', line 21

def control
  @control
end

#rightArray<FiberControl>

Returns The next fiber controls.

Returns:



19
20
21
# File 'lib/ductr/etl/fiber_control.rb', line 19

def right
  @right
end

Instance Method Details

#fiberFiber

Memoizes the fiber to be associated with the ETL control based on its type.

Returns:

  • (Fiber)

    The fiber in charge of executing the control’s logic



41
42
43
# File 'lib/ductr/etl/fiber_control.rb', line 41

def fiber
  @fiber ||= send(@type)
end

#resumevoid

This method returns an undefined value.

Resumes the control’s fiber.

Parameters:

  • row (Object)

    The row to pass to right fiber controls



16
# File 'lib/ductr/etl/fiber_control.rb', line 16

def_delegators :fiber, :resume