Class: Catlogic::Term
- Inherits:
-
Object
- Object
- Catlogic::Term
- Defined in:
- lib/catlogic/term.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #distribution_predicate(quality) ⇒ Object
- #distribution_subject(quantity) ⇒ Object
-
#initialize(termname) ⇒ Term
constructor
A new instance of Term.
- #opposite ⇒ Object
- #to_term ⇒ Object
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
#label ⇒ Object (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 |
#opposite ⇒ Object
9 10 11 12 |
# File 'lib/catlogic/term.rb', line 9 def opposite opposite = Term.new("non-#{@label}") return opposite end |
#to_term ⇒ Object
32 33 34 |
# File 'lib/catlogic/term.rb', line 32 def to_term self end |