Class: Literal
- Inherits:
-
Object
- Object
- Literal
- Defined in:
- lib/logical/formulas/literal.rb
Instance Attribute Summary collapse
-
#letter ⇒ Object
readonly
Returns the value of attribute letter.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #evaluate(interpretation) ⇒ Object
-
#initialize(letter) ⇒ Literal
constructor
A new instance of Literal.
- #literals ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(letter) ⇒ Literal
Returns a new instance of Literal.
6 7 8 |
# File 'lib/logical/formulas/literal.rb', line 6 def initialize(letter) @letter = letter end |
Instance Attribute Details
#letter ⇒ Object (readonly)
Returns the value of attribute letter.
4 5 6 |
# File 'lib/logical/formulas/literal.rb', line 4 def letter @letter end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/logical/formulas/literal.rb', line 22 def ==(other) other.class == Literal && other.letter == letter end |
#evaluate(interpretation) ⇒ Object
10 11 12 |
# File 'lib/logical/formulas/literal.rb', line 10 def evaluate(interpretation) interpretation.evaluate(@letter) end |
#literals ⇒ Object
18 19 20 |
# File 'lib/logical/formulas/literal.rb', line 18 def literals Set[self] end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/logical/formulas/literal.rb', line 14 def to_s @letter end |