class OFlow::Link

A Link is the data needed to link one Task with another so that when the ship() method is called the data can be delivered to the destination Task.

Attributes

flow_name[R]

Name of the target's parent flow.

op[R]

Operation to provide the target.

target[R]

The actual target Task.

target_name[R]

Name of the target.

Public Class Methods

new(flow_name, target_name, op) click to toggle source

Creates a new Link. This is called from link() and route() methods on Tasks and Flows. @param flow_name [Symbol|String] parent flow name to find the target task in or nil for this parent @param target_name [Symbol] target Task base name @param op [Symbol] operation to use on the target @param ingress [true|false] indicates the Link is internal @return [Link] new Link

# File lib/oflow/link.rb, line 24
def initialize(flow_name, target_name, op)
  @target_name = target_name
  @flow_name = flow_name
  @op = op
  @target = nil
end

Public Instance Methods

inspect()
Alias for: to_s
ship(box) click to toggle source

Delivers a package (Box) to the target. @param box [Box] package to deliver

# File lib/oflow/link.rb, line 33
def ship(box)
  @target.receive(@op, box)
end
to_s() click to toggle source

Returns a string representation of the Link.

# File lib/oflow/link.rb, line 38
def to_s()
  if @flow_name.nil?
    "Link{target_name: #{@target_name}, op: #{op}, target: #{@target}}"
  else
    "Link{target_name: #{@flow_name}:#{@target_name}, op: #{op}, target: #{@target}}"
  end
end
Also aliased as: inspect