Class: Interpretation
- Inherits:
-
Object
- Object
- Interpretation
- Defined in:
- lib/logical/interpretation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #evaluate(letter) ⇒ Object
-
#initialize(hash) ⇒ Interpretation
constructor
A new instance of Interpretation.
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ Interpretation
Returns a new instance of Interpretation.
4 5 6 |
# File 'lib/logical/interpretation.rb', line 4 def initialize(hash) @hash = hash end |
Class Method Details
.all(letters) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/logical/interpretation.rb', line 16 def self.all(letters) [true, false] .repeated_permutation(letters.size) .map do |disposition| mapping = {} letters.each_with_index do |letter, i| mapping[letter] = disposition[i] end Interpretation.new(mapping) end end |
Instance Method Details
#evaluate(letter) ⇒ Object
8 9 10 |
# File 'lib/logical/interpretation.rb', line 8 def evaluate(letter) @hash[letter] end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/logical/interpretation.rb', line 12 def to_s @hash.to_s end |