Class: Catlogic::Term

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(termname) ⇒ Term

Returns a new instance of Term.



5
6
7
# File 'lib/catlogic/term.rb', line 5

def initialize(termname)
  @label = termname
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/catlogic/term.rb', line 3

def label
  @label
end

Instance Method Details

#distribution_predicate(quality) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/catlogic/term.rb', line 24

def distribution_predicate(quality)
  if quality.label == 'affirmative'
    @distribution = Distribution.new('undistributed')
  elsif quality.label == 'negative'
    @distribution = Distribution.new('distributed')
  end
  return @distribution
end

#distribution_subject(quantity) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/catlogic/term.rb', line 14

def distribution_subject(quantity)
    if quantity.label == 'universal'
      @distribution = Distribution.new('distributed')
    elsif quantity.label == 'particular'
      @distribution = Distribution.new('undistributed')
    end
  return @distribution

end

#oppositeObject



9
10
11
12
# File 'lib/catlogic/term.rb', line 9

def opposite
  opposite = Term.new("non-#{@label}")
  return opposite
end

#to_termObject



32
33
34
# File 'lib/catlogic/term.rb', line 32

def to_term
  self
end