Class: Simulator::BoundVariable

Inherits:
Object
  • Object
show all
Defined in:
lib/simulator/bound_variable.rb

Overview

represents a variable bound to a context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variable, context) ⇒ BoundVariable

Returns a new instance of BoundVariable.



7
8
9
10
11
# File 'lib/simulator/bound_variable.rb', line 7

def initialize(variable, context)
  @variable = variable
  @value = @variable.default_value
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



5
6
7
# File 'lib/simulator/bound_variable.rb', line 5

def context
  @context
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/simulator/bound_variable.rb', line 4

def value
  @value
end

#variableObject (readonly)

Returns the value of attribute variable.



5
6
7
# File 'lib/simulator/bound_variable.rb', line 5

def variable
  @variable
end

Instance Method Details

#nameObject



13
14
15
# File 'lib/simulator/bound_variable.rb', line 13

def name
  @variable.name
end