Class: Variable
- Inherits:
-
Object
- Object
- Variable
- Defined in:
- lib/sdx/vm/variables.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(val, type, scope) ⇒ Variable
constructor
A new instance of Variable.
- #set(val) ⇒ Object
Constructor Details
#initialize(val, type, scope) ⇒ Variable
Returns a new instance of Variable.
5 6 7 8 9 |
# File 'lib/sdx/vm/variables.rb', line 5 def initialize(val, type, scope) @value = val @type = type @scope = scope end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/sdx/vm/variables.rb', line 3 def scope @scope end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/sdx/vm/variables.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/sdx/vm/variables.rb', line 3 def value @value end |
Instance Method Details
#set(val) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/sdx/vm/variables.rb', line 11 def set(val) if @mut == true @value = val else puts "cant change value of immutable" # add error handling end end |