Class: Plumb::Step

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/plumb/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Composable

#>>, #[], #as_node, #build, #check, #defer, #generate, included, #invalid, #invoke, #match, #metadata, #not, #pipeline, #policy, #static, #to_json_schema, #to_s, #transform, #value, wrap, #|

Methods included from Callable

#parse, #resolve

Constructor Details

#initialize(callable = nil, inspect = nil, &block) ⇒ Step

Returns a new instance of Step.



11
12
13
14
15
16
17
# File 'lib/plumb/step.rb', line 11

def initialize(callable = nil, inspect = nil, &block)
  @_metadata = callable.respond_to?(:metadata) ? callable. : BLANK_HASH
  @callable = callable || block
  @children = [@callable].freeze
  @inspect = inspect || @callable.inspect
  freeze
end

Instance Attribute Details

#_metadataObject (readonly)

Returns the value of attribute _metadata.



9
10
11
# File 'lib/plumb/step.rb', line 9

def 
  @_metadata
end

#childrenObject (readonly)

Returns the value of attribute children.



9
10
11
# File 'lib/plumb/step.rb', line 9

def children
  @children
end

Instance Method Details

#call(result) ⇒ Object



19
20
21
# File 'lib/plumb/step.rb', line 19

def call(result)
  @callable.call(result)
end