Class: Conductor::Workflow::Dsl::OutputRef

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/workflow/dsl/output_ref.rb

Overview

OutputRef enables chained [] access for nested output paths task[:body][:items] => "$task_reftask_ref.outputtask_ref.output.responsetask_ref.output.response.bodytask_ref.output.response.body.items"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ OutputRef

Returns a new instance of OutputRef.



11
12
13
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 11

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 9

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

Compare OutputRefs by their paths



32
33
34
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 32

def ==(other)
  other.is_a?(OutputRef) && @path == other.path
end

#[](field) ⇒ OutputRef

Enable chained [] access

Parameters:

  • field (String, Symbol)

    The field name

Returns:

  • (OutputRef)

    A new OutputRef with the extended path



18
19
20
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 18

def [](field)
  OutputRef.new("#{@path}.#{field}")
end

#hashObject



38
39
40
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 38

def hash
  @path.hash
end

#to_sString Also known as: to_str

Convert to expression string for use in input parameters

Returns:

  • (String)

    The expression in $... format



24
25
26
# File 'lib/conductor/workflow/dsl/output_ref.rb', line 24

def to_s
  "${#{@path}}"
end