Class: Cyc::Symbol

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#nameObject (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_sObject

String representation of the symbol.



16
17
18
# File 'lib/cyc/symbol.rb', line 16

def to_s
  self.to_cyc
end