class T2Server::OutputPort

Represents an output port of a workflow.

Public Instance Methods

[int] → obj click to toggle source

This call provides access to the underlying structure of the OutputPort. It can only be used for ports of depth >= 1. For singleton ports, use #value instead.

Example usage - To get part of a value from an output port with depth 3: port[0].value(10…100)

# File lib/t2-server/port.rb, line 192
def [](i)
  return @structure if depth == 0
  @structure[i]
end
error → String click to toggle source

Get the error message (if there is one) of this output port.

This method is only for use on outputs of depth 0. For other depths use ‘port[].error’

# File lib/t2-server/port.rb, line 266
def error
  return nil unless depth == 0
  @structure.error
end
error? → bool click to toggle source

Is there an error associated with this output port?

# File lib/t2-server/port.rb, line 179
def error?
  @error
end
reference → String click to toggle source
reference → Array

Get URI references to the data values of this output port as strings.

For a singleton output a single uri is returned. For lists an array of uris is returned. For an individual reference from a list use ‘port[].reference’.

# File lib/t2-server/port.rb, line 228
def reference
  @refs = strip(:reference) if @refs.nil?
  @refs
end
size → int click to toggle source
size → Array

Get the data size of the data value in this output port.

For a singleton output a single size is returned. For lists an array of sizes is returned. For an individual size from a list use ‘port[].size’.

# File lib/t2-server/port.rb, line 254
def size
  @sizes = strip(:size) if @sizes.nil?
  @sizes
end
total_size → int click to toggle source

Return the total data size of all the data in this output port.

# File lib/t2-server/port.rb, line 275
def total_size
  return @total_size if @total_size
  if @structure.instance_of? Array
    return 0 if @structure.empty?
    @total_size = strip(:size).flatten.inject { |sum, i| sum + i }
  else
    @total_size = size
  end
end
type → String click to toggle source
type → Array

Get the mime type of the data value in this output port.

For a singleton output a single type is returned. For lists an array of types is returned. For an individual type from a list use ‘port[].type’.

# File lib/t2-server/port.rb, line 241
def type
  @types = strip(:type) if @types.nil?
  @types
end
value → obj click to toggle source
value(range) → obj
value → Array

For singleton outputs get the value (or part of it). For list outputs get all the values in an Array structure that mirrors the structure of the output port. To get part of a value from a list use ‘port[].value(range)’.

# File lib/t2-server/port.rb, line 206
def value(range = nil)
  if depth == 0
    if range.nil?
      @structure.value
    else
      @structure.value(range)
    end
  else
    @values = strip(:value) if @values.nil?
    @values
  end
end