Class: Plumb::Step
Instance Attribute Summary collapse
-
#_metadata ⇒ Object
readonly
Returns the value of attribute _metadata.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #call(result) ⇒ Object
-
#initialize(callable = nil, inspect = nil, &block) ⇒ Step
constructor
A new instance of Step.
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
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
#_metadata ⇒ Object (readonly)
Returns the value of attribute _metadata.
9 10 11 |
# File 'lib/plumb/step.rb', line 9 def @_metadata end |
#children ⇒ Object (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 |