Class: Unific::Var

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

Overview

A unification variable

Direct Known Subclasses

Wildcard

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



202
203
204
# File 'lib/unific.rb', line 202

def name
  @name
end

Instance Method Details

#to_sObject

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