Class: Catlogic::PropositionType
- Inherits:
-
Object
- Object
- Catlogic::PropositionType
- Defined in:
- lib/catlogic/proposition_type.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#truthvalue ⇒ Object
readonly
Returns the value of attribute truthvalue.
Instance Method Summary collapse
-
#initialize(type, truthvalue = true) ⇒ PropositionType
constructor
A new instance of PropositionType.
- #proposition ⇒ Object
- #quality ⇒ Object
- #quantity ⇒ Object
- #to_proposition_type ⇒ Object
Constructor Details
#initialize(type, truthvalue = true) ⇒ PropositionType
Returns a new instance of PropositionType.
6 7 8 9 10 |
# File 'lib/catlogic/proposition_type.rb', line 6 def initialize(type, truthvalue=true) @type = type @label = type @truthvalue = truthvalue end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/catlogic/proposition_type.rb', line 4 def label @label end |
#truthvalue ⇒ Object (readonly)
Returns the value of attribute truthvalue.
4 5 6 |
# File 'lib/catlogic/proposition_type.rb', line 4 def truthvalue @truthvalue end |
Instance Method Details
#proposition ⇒ Object
44 45 46 47 |
# File 'lib/catlogic/proposition_type.rb', line 44 def proposition proposition = Proposition.new(Quantity.new(self.quantity.label), Term.new("S"), Quality.new(self.quality.label), Term.new("P"), @truthvalue) return proposition end |
#quality ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/catlogic/proposition_type.rb', line 29 def quality if @label == "A" quality = Quality.new("affirmative") elsif @label == "E" quality = Quality.new("negative") elsif @label == "I" quality = Quality.new("affirmative") elsif @label == "O" quality = Quality.new("negative") else quality = "not a valid type" end return quality end |
#quantity ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/catlogic/proposition_type.rb', line 15 def quantity if @label == "A" quantity = Quantity.new("universal") elsif @label == "E" quantity = Quantity.new("universal") elsif @label == "I" quantity = Quantity.new("particular") elsif @label == "O" quantity = Quantity.new("particular") else quantity = "not a valid type" end return quantity end |
#to_proposition_type ⇒ Object
11 12 13 |
# File 'lib/catlogic/proposition_type.rb', line 11 def to_proposition_type self end |