Class: T2Server::InputPort

Inherits:
Port
  • Object
show all
Defined in:
lib/t2-server/port.rb

Overview

Represents an input to a workflow.

Instance Attribute Summary collapse

Attributes inherited from Port

#depth, #name

Instance Method Summary collapse

Methods included from XML::Methods

#get_uris_from_doc, #xml_children, #xml_document, #xml_first_child, #xml_node_attribute, #xml_node_content, #xml_node_name, #xml_text_node, #xpath_attr, #xpath_compile, #xpath_find, #xpath_first

Constructor Details

#initialize(run, xml) ⇒ InputPort

:stopdoc: Create a new InputPort.



76
77
78
79
80
81
82
# File 'lib/t2-server/port.rb', line 76

def initialize(run, xml)
  super(run, xml)

  @value = nil
  @file = nil
  @remote_file = false
end

Instance Attribute Details

#fileObject

If set, the file which has been used to supply this port’s data.



69
70
71
# File 'lib/t2-server/port.rb', line 69

def file
  @file
end

#valueObject

If set, the value held by this port. Could be a list (of lists (etc)).



72
73
74
# File 'lib/t2-server/port.rb', line 72

def value
  @value
end

Instance Method Details

#baclava?Boolean

:call-seq:

baclava? -> true or false

Has this port been set via a baclava document?

Returns:

  • (Boolean)


145
146
147
# File 'lib/t2-server/port.rb', line 145

def baclava?
  @run.baclava_input?
end

#file?Boolean

:call-seq:

file? -> true or false

Is this port’s data being supplied by a file? The file could be local or remote (already on the server) for this to return true.

Returns:

  • (Boolean)


102
103
104
# File 'lib/t2-server/port.rb', line 102

def file?
  !@file.nil?
end

#remote_file=(filename) ⇒ Object

:call-seq:

remote_file = filename

Set the remote file to use for this port’s data. The file must already be on the server. This has no effect if the run is already running or finished.



121
122
123
124
125
126
# File 'lib/t2-server/port.rb', line 121

def remote_file=(filename)
  return unless @run.initialized?
  @value = nil
  @file = filename
  @remote_file = true
end

#remote_file?Boolean

:call-seq:

remote_file? -> true or false

Is this port’s data being supplied by a remote (one that is already on the server) file?

Returns:

  • (Boolean)


111
112
113
# File 'lib/t2-server/port.rb', line 111

def remote_file?
  file? && @remote_file
end

#set?Boolean

:call-seq:

set? -> true or false

Has this port been set?

Returns:

  • (Boolean)


153
154
155
# File 'lib/t2-server/port.rb', line 153

def set?
  !value.nil? || file? || baclava?
end