Class: Cyc::Term

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

Instance Method Summary collapse

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

Returns:

  • (Boolean)


39
40
41
# File 'lib/cyc/term.rb', line 39

def eql?(other)
  self == other
end

#hashObject



43
44
45
# File 'lib/cyc/term.rb', line 43

def hash
  @ruby_term.hash
end

#idObject

Return external ID of the term.



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

def id
  @id
end

#inspectObject Also known as: to_s

Inspect the term.



26
27
28
# File 'lib/cyc/term.rb', line 26

def inspect
  "#{@ruby_term}:#{@id}"
end

#nameObject



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_rubyObject

Return Ruby representation of the term.



11
12
13
# File 'lib/cyc/term.rb', line 11

def to_ruby
  @ruby_term
end