class LittleWeasel::BlockResults
This class represents the results of gathering information about a word block (group of words).
Attributes
:reek: Attribute - Ignored, it doesn't make sense to create a formal setter method.
:reek: Attribute - Ignored, it doesn't make sense to create a formal setter method.
Public Class Methods
# File lib/LittleWeasel/block_results.rb, line 13 def initialize(original_word_block:) self.original_word_block = original_word_block self.word_results = [] end
Public Instance Methods
# File lib/LittleWeasel/block_results.rb, line 18 def <<(word_result) unless word_result.is_a? WordResults raise ArgumentError, "Argument word_result is not a WordResults object: #{word_result.class}" end word_results << word_result end
Returns true if all WordResults
object words have filter matches (filters_match?
); false otherwise.
# File lib/LittleWeasel/block_results.rb, line 44 def filters_match? return false unless word_results.present? word_results.all?(&:filter_match?) end
Returns true if all WordResults
object words have been preprocessed (preprocessed_words?
); false otherwise.
# File lib/LittleWeasel/block_results.rb, line 52 def preprocessed_words? return false unless word_results.present? word_results.all?(&:preprocessed_word?) end
Calls preprocessed_word_or_original_word on all WordResults
objects. An Array of the results is returned.
# File lib/LittleWeasel/block_results.rb, line 63 def preprocessed_words_or_original_words return [] unless word_results.present? word_results.map(&:preprocessed_word_or_original_word) end
Calls success?
on all WordResults
objects. Returns true if all WordResults
return true; false is returned otherwise.
# File lib/LittleWeasel/block_results.rb, line 28 def success? return false unless word_results.present? word_results.all?(&:success?) end
Returns true if all WordResults
object words have been cached (words_cached?
); false otherwise.
# File lib/LittleWeasel/block_results.rb, line 71 def words_cached? return false unless word_results.present? word_results.all?(&:word_cached?) end
Returns true if all WordResults
object words are valid (word_valid?); false otherwise.
# File lib/LittleWeasel/block_results.rb, line 36 def words_valid? return false unless word_results.present? word_results.all?(&:word_valid?) end