Class: Orchestra::Recording::Node

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/orchestra/recording/node.rb

Overview

Reader object to expose operations and steps to the outside world

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_or_operation, name, input) ⇒ Node

Returns a new instance of Node.



12
13
14
15
16
17
# File 'lib/orchestra/recording/node.rb', line 12

def initialize step_or_operation, name, input
  @name = name
  @node = step_or_operation
  @input = format_input input
  freeze
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



5
6
7
# File 'lib/orchestra/recording/node.rb', line 5

def input
  @input
end

Instance Method Details

#inspectObject



30
31
32
33
34
35
# File 'lib/orchestra/recording/node.rb', line 30

def inspect
  params = to_h.each_with_object [] do |(key, val), list|
  list << "#{key}=#{val.inspect}"
  end
  "#<Orchestra::Node #{params.join ', '}>"
end

#operation?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/orchestra/recording/node.rb', line 37

def operation?
  @node.is_a? Operation
end

#step?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/orchestra/recording/node.rb', line 41

def step?
  not operation?
end

#to_hObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/orchestra/recording/node.rb', line 19

def to_h
  {
    dependencies: dependencies,
    input: input,
    name: name,
    optional_dependencies: optional_dependencies,
    provisions: provisions,
    required_dependencies: required_dependencies,
  }
end