Class: Core::Pipeline::Actions::Method

Inherits:
Core::Pipeline::Action show all
Includes:
Inspect
Defined in:
lib/core/pipeline/actions/method.rb

Overview

[public] A pipeline action defined as a method.

Instance Attribute Summary

Attributes inherited from Core::Pipeline::Action

#after, #before, #context, #name

Instance Method Summary collapse

Methods inherited from Core::Pipeline::Action

build, build_name, #curried?, generate_random_suffix

Constructor Details

#initialize(name = nil, before: nil, after: nil, context: nil, curry: false) ⇒ Method

Returns a new instance of Method.



13
14
15
16
17
# File 'lib/core/pipeline/actions/method.rb', line 13

def initialize(name = nil, before: nil, after: nil, context: nil, curry: false)
  @method = nil

  super(name, before: before, after: after, context: context, curry: curry)
end

Instance Method Details

#finalize(context) ⇒ Object

[public]



21
22
23
24
25
26
27
28
29
# File 'lib/core/pipeline/actions/method.rb', line 21

def finalize(context)
  case @context
  when NilClass
    context.instance_method(@name)
    @name
  else
    @context.method(@name).to_proc
  end
end