class Clausewitz::Spelling::MisspelledWordResult

Public Class Methods

new(word, suggestions) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 234
def initialize(word, suggestions)
  @word        = word
  @suggestions = suggestions
end

Public Instance Methods

failed?() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 239
def failed?
  true
end
to_s() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 243
def to_s
  to_str
end
to_str(indent = 0) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 247
def to_str(indent = 0)
  spacer = ' ' * indent
  msg = "#{spacer}#{@word}".red

  if @suggestions && !@suggestions.empty?
    msg += " (#{@suggestions.map { |sug| sug.encode('utf-8') }.join(', ')})".yellow
  else
    msg += " (-- no suggestions --)".yellow
  end

  msg
end