Class: Cyc::Variable
- Inherits:
-
Object
- Object
- Cyc::Variable
- Defined in:
- lib/cyc/variable.rb
Overview
- Author
-
Aleksander Pohl ([email protected])
- License
-
MIT/X11 License
This class represent the Cyc variable.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The name of the variable.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Two variables are equal if they have the same name.
-
#initialize(name) ⇒ Variable
constructor
Initialize the variable with its
name
. -
#to_cyc(raw = false) ⇒ Object
Representation of the variable understandable by Cyc.
-
#to_s ⇒ Object
String representation of the variable.
Constructor Details
#initialize(name) ⇒ Variable
Initialize the variable with its name
.
11 12 13 |
# File 'lib/cyc/variable.rb', line 11 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
The name of the variable.
8 9 10 |
# File 'lib/cyc/variable.rb', line 8 def name @name end |
Instance Method Details
#==(other) ⇒ Object
Two variables are equal if they have the same name.
26 27 28 29 |
# File 'lib/cyc/variable.rb', line 26 def ==(other) return false if other.class != self.class self.name == other.name end |
#to_cyc(raw = false) ⇒ Object
Representation of the variable understandable by Cyc.
21 22 23 |
# File 'lib/cyc/variable.rb', line 21 def to_cyc(raw=false) "?#{@name}" end |
#to_s ⇒ Object
String representation of the variable.
16 17 18 |
# File 'lib/cyc/variable.rb', line 16 def to_s self.to_cyc end |