Class: PortableExpressions::Variable
- Inherits:
-
Object
- Object
- PortableExpressions::Variable
- Includes:
- Serializable
- Defined in:
- lib/portable_expressions/variable.rb
Overview
A ‘Variable` represents a named value stored in the `Environment`. Unlike `Scalars`, `Variables` have no value until they are evaluated by an `Environment`. Evaluating a `Variable` that isn’t present in the ‘Environment` will result in a `MissingVariableError`.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(name) ⇒ Variable
constructor
A new instance of Variable.
- #to_s ⇒ Object
Methods included from Serializable
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable.
12 13 14 |
# File 'lib/portable_expressions/variable.rb', line 12 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/portable_expressions/variable.rb', line 10 def name @name end |
Instance Method Details
#as_json ⇒ Object
20 21 22 23 24 |
# File 'lib/portable_expressions/variable.rb', line 20 def as_json super.merge( name: name ) end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/portable_expressions/variable.rb', line 16 def to_s name end |