class Clausewitz::Spelling::UnparseableFileResult

Result capturing problems parsing a readable file.

Attributes

errors[R]
filepath[R]

Public Class Methods

new(filepath, errors) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 292
def initialize(filepath, errors)
  @filepath = filepath
  @errors   = Array(errors)
end

Public Instance Methods

failed?() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 297
def failed?
  true
end
failure_total() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 301
def failure_total
  errors.size
end
to_s() click to toggle source
# File lib/clausewitz/spelling/results.rb, line 305
def to_s
  to_str
end
to_str(indent = 0) click to toggle source
# File lib/clausewitz/spelling/results.rb, line 309
def to_str(indent = 0)
  spacer = ' ' * indent
  secondspacer = ' ' * (indent + 2)
  "#{spacer}#{@filepath} could not be parsed\n".red +
    @errors.map { |e| "#{secondspacer}#{e}".red }.join("\n")
end