Class: Unific::Var
- Inherits:
-
Object
- Object
- Unific::Var
- Defined in:
- lib/unific.rb
Overview
A unification variable
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name = "new_var") ⇒ Var
constructor
Create a new variable.
-
#to_s ⇒ Object
Return a string representing a variable.
Constructor Details
#initialize(name = "new_var") ⇒ Var
Create a new variable
The optional argument provides a name for use in printing the variable
207 208 209 210 |
# File 'lib/unific.rb', line 207 def initialize name = "new_var" @name = name self.freeze end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
202 203 204 |
# File 'lib/unific.rb', line 202 def name @name end |
Instance Method Details
#to_s ⇒ Object
Return a string representing a variable
A variable named“foo” is presented as as “?foo”
215 216 217 |
# File 'lib/unific.rb', line 215 def to_s "?#{@name}" end |