Module: NxtPipeline

Defined in:
lib/nxt_pipeline.rb,
lib/nxt_pipeline/step.rb,
lib/nxt_pipeline/logger.rb,
lib/nxt_pipeline/version.rb,
lib/nxt_pipeline/pipeline.rb,
lib/nxt_pipeline/callbacks.rb,
lib/nxt_pipeline/error_callback.rb

Defined Under Namespace

Classes: Callbacks, ErrorCallback, Logger, Pipeline, Step

Constant Summary collapse

VERSION =
"2.0.0".freeze

Class Method Summary collapse

Class Method Details

.configuration(name, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/nxt_pipeline.rb', line 15

def configuration(name, &block)
  @configurations ||= {}

  if block_given?
    raise ArgumentError, "Configuration already defined for #{name}" if @configurations[name].present?
    @configurations[name] = block
  else
    @configurations.fetch(name)
  end
end

.constructor(name, default: false, &block) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nxt_pipeline.rb', line 26

def constructor(name, default: false, &block)
  @constructors ||= {}

  if block_given?
    raise ArgumentError, "Constructor already defined for #{name}" if @constructors[name].present?

    default_constructor_name(name) if default
    @constructors[name] = block
  else
    @constructors.fetch(name)
  end
end

.default_constructor_name(name = nil) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/nxt_pipeline.rb', line 39

def default_constructor_name(name = nil)
  if name.present?
    raise ArgumentError, "Default constructor #{@default_constructor_name} defined already" if @default_constructor_name.present?
    @default_constructor_name = name
  else
    @default_constructor_name
  end
end