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