Class: 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.



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

def initialize(termname)
  @label = termname
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



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

def label
  @label
end

Instance Method Details

#distribution_predicate(quality) ⇒ Object



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

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



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

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



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

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