Class: Romanesco::VariableOperand
- Inherits:
-
Operand
- Object
- Expression
- Operand
- Romanesco::VariableOperand
- Defined in:
- lib/romanesco/elements/variable_operand.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Expression
Instance Method Summary collapse
- #evaluate(options) ⇒ Object
-
#initialize(name) ⇒ VariableOperand
constructor
A new instance of VariableOperand.
- #to_s ⇒ Object
Methods inherited from Operand
Constructor Details
#initialize(name) ⇒ VariableOperand
Returns a new instance of VariableOperand.
10 11 12 |
# File 'lib/romanesco/elements/variable_operand.rb', line 10 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/romanesco/elements/variable_operand.rb', line 8 def name @name end |
Instance Method Details
#evaluate(options) ⇒ Object
14 15 16 17 18 |
# File 'lib/romanesco/elements/variable_operand.rb', line 14 def evaluate() element = [@name.to_sym] return element.evaluate() if element.respond_to?(:evaluate) [@name.to_sym].to_f if element.is_a? Numeric end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/romanesco/elements/variable_operand.rb', line 20 def to_s @name.to_s end |