Class: Clausewitz::Spelling::EntryResults
- Inherits:
-
Object
- Object
- Clausewitz::Spelling::EntryResults
- Defined in:
- lib/clausewitz/spelling/results.rb
Instance Method Summary collapse
- #failed? ⇒ Boolean
- #ignored? ⇒ Boolean
-
#initialize(key, word_results) ⇒ EntryResults
constructor
A new instance of EntryResults.
- #to_s ⇒ Object
- #to_str(indent = 0) ⇒ Object
Constructor Details
#initialize(key, word_results) ⇒ EntryResults
Returns a new instance of EntryResults.
123 124 125 126 |
# File 'lib/clausewitz/spelling/results.rb', line 123 def initialize(key, word_results) @key = key @word_results = word_results end |
Instance Method Details
#failed? ⇒ Boolean
132 133 134 |
# File 'lib/clausewitz/spelling/results.rb', line 132 def failed? !@word_results.empty? end |
#ignored? ⇒ Boolean
128 129 130 |
# File 'lib/clausewitz/spelling/results.rb', line 128 def ignored? false end |
#to_s ⇒ Object
136 137 138 |
# File 'lib/clausewitz/spelling/results.rb', line 136 def to_s to_str end |
#to_str(indent = 0) ⇒ Object
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/clausewitz/spelling/results.rb', line 140 def to_str(indent = 0) spacer = ' ' * indent if failed? outlines = @word_results.map { |w| "#{spacer}#{w.to_str(indent + 2)}" } outlines = outlines.join("\n") "#{spacer}#{@key.red}\n#{outlines}" else "#{spacer}#{@key} passed".green end end |