Class: Procedo::Procedure::Computation

Inherits:
Field
  • Object
show all
Defined in:
lib/procedo/procedure/computation.rb

Overview

A Computation defines an information computed to stored in given destinations

Instance Attribute Summary collapse

Attributes inherited from Field

#name, #parameter

Instance Method Summary collapse

Methods inherited from Field

code_trees, count_variables, dependent_parameters, detect, detect_environment_variable, detect_parameter, each, parse!

Constructor Details

#initialize(parameter, name, options = {}) ⇒ Computation

Returns a new instance of Computation.


11
12
13
14
15
16
# File 'lib/procedo/procedure/computation.rb', line 11

def initialize(parameter, name, options = {})
  super(parameter, name, options)
  @destinations = options[:destinations]
  self.expression = options[:expression]
  self.condition = options[:if]
end

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations


9
10
11
# File 'lib/procedo/procedure/computation.rb', line 9

def destinations
  @destinations
end

Instance Method Details

#depend_on?(parameter_name) ⇒ Boolean

Returns:

  • (Boolean)

18
19
20
21
# File 'lib/procedo/procedure/computation.rb', line 18

def depend_on?(parameter_name)
  expression_with_parameter?(parameter_name) ||
    condition_with_parameter?(parameter_name)
end