Class: Ruflow::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/ruflow/action.rb

Direct Known Subclasses

Flow

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/ruflow/action.rb', line 4

def options
  @options
end

Class Method Details

.change_options(_options = {}) ⇒ Object



8
9
10
# File 'lib/ruflow/action.rb', line 8

def change_options(_options = {})
  self.options = options.merge(_options)
end

.input_typeObject



37
38
39
# File 'lib/ruflow/action.rb', line 37

def input_type
  options[:input]
end

.start(param = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ruflow/action.rb', line 18

def start(param = nil)
  _param = param.nil? ? options[:default_input] : param

  type_check_input!(_param, input_type)
  output_port_and_value = self.new.start(_param)

  check_return!(output_port_and_value)

  output_port, value = output_port_and_value

  check_output_port_is_defined!(output_port)

  output_type = options[:output][output_port]

  type_check_output!(value, output_type)

  [output_port, value]
end

.with_custom_options(_options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/ruflow/action.rb', line 12

def with_custom_options(_options = {})
  klass = self.clone
  klass.change_options(_options)
  klass
end

Instance Method Details

#start(value = nil) ⇒ Object

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/ruflow/action.rb', line 82

def start(value = nil)
  raise NotImplementedError, 'Overwrite instance method start'
end