Class: PiecePipe::MethodAssemblyStep

Inherits:
AssemblyStep show all
Defined in:
lib/piece_pipe/method_assembly_step.rb

Overview

Essentially the same thing as MethodStep with AssemblyStep semantics.

Because we don’t have a clever way to determine that you might want to create an assembly line out of wrapped methods, you need to use the conveneince method Pipeline#assembly_step, eg.

PiecePipe::Pipeline.new.assembly_step(:add_seatbelts)

Currently only supports arity-1 methods: the parameter will be the inputs Hash, the return is expected to be a Hash that will be produced via AssemblyStep#install.

TODO; add support for arity-2 method wrapping to allow for zero-or-more #intall calls

Instance Attribute Summary

Attributes inherited from Step

#source

Instance Method Summary collapse

Methods inherited from AssemblyStep

#install, #noop, #process

Methods inherited from Step

#to_enum

Constructor Details

#initialize(meth) ⇒ MethodAssemblyStep

Returns a new instance of MethodAssemblyStep.



15
16
17
# File 'lib/piece_pipe/method_assembly_step.rb', line 15

def initialize(meth)
  @method = meth
end

Instance Method Details

#receive(inputs) ⇒ Object



19
20
21
# File 'lib/piece_pipe/method_assembly_step.rb', line 19

def receive(inputs)
  install(@method.call(inputs))
end