Class: EncodingChecker::Match

Inherits:
Struct
  • Object
show all
Defined in:
lib/encoding_checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#encodingObject

Returns the value of attribute encoding

Returns:

  • (Object)

    the current value of encoding



38
39
40
# File 'lib/encoding_checker.rb', line 38

def encoding
  @encoding
end

#invalid_linesObject

Returns the value of attribute invalid_lines

Returns:

  • (Object)

    the current value of invalid_lines



38
39
40
# File 'lib/encoding_checker.rb', line 38

def invalid_lines
  @invalid_lines
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/encoding_checker.rb', line 39

def empty?
  invalid_lines.empty?
end

#to_sObject



43
44
45
46
47
48
49
# File 'lib/encoding_checker.rb', line 43

def to_s
  invalid_lines.map { |line|
    result = %(#{encoding.to_s.upcase} error on line #{line}"\n)
    result << 'Invalid characters: ' << line.invalid_characters.join(', ') << "\n"
    result
  }.join("\n")
end