Class: Cyc::Term
- Inherits:
-
Object
- Object
- Cyc::Term
- Defined in:
- lib/cyc/term.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#id ⇒ Object
Return external ID of the term.
-
#initialize(ruby_term, id) ⇒ Term
constructor
Create new Term using Ruby representation of the term (Symbol or Array).
-
#inspect ⇒ Object
(also: #to_s)
Inspect the term.
- #name ⇒ Object
-
#to_cyc(raw = false) ⇒ Object
Return Cyc-protocol compatible representation of the term.
-
#to_ruby ⇒ Object
Return Ruby representation of the term.
Constructor Details
#initialize(ruby_term, id) ⇒ Term
Create new Term using Ruby representation of the term (Symbol or Array).
5 6 7 8 |
# File 'lib/cyc/term.rb', line 5 def initialize(ruby_term,id) @ruby_term = ruby_term @id = id end |
Instance Method Details
#==(other) ⇒ Object
34 35 36 37 |
# File 'lib/cyc/term.rb', line 34 def ==(other) return false if !(self.class === other) @ruby_term == other.to_ruby end |
#eql?(other) ⇒ Boolean
39 40 41 |
# File 'lib/cyc/term.rb', line 39 def eql?(other) self == other end |
#hash ⇒ Object
43 44 45 |
# File 'lib/cyc/term.rb', line 43 def hash @ruby_term.hash end |
#id ⇒ Object
Return external ID of the term.
16 17 18 |
# File 'lib/cyc/term.rb', line 16 def id @id end |
#inspect ⇒ Object Also known as: to_s
Inspect the term.
26 27 28 |
# File 'lib/cyc/term.rb', line 26 def inspect "#{@ruby_term}:#{@id}" end |
#name ⇒ Object
30 31 32 |
# File 'lib/cyc/term.rb', line 30 def name self.to_ruby.to_s end |
#to_cyc(raw = false) ⇒ Object
Return Cyc-protocol compatible representation of the term.
21 22 23 |
# File 'lib/cyc/term.rb', line 21 def to_cyc(raw=false) self.to_ruby.to_cyc(raw) end |
#to_ruby ⇒ Object
Return Ruby representation of the term.
11 12 13 |
# File 'lib/cyc/term.rb', line 11 def to_ruby @ruby_term end |