Exception: NestedText::Errors::ParseInvalidIndentationCharError

Inherits:
ParseError show all
Defined in:
lib/nestedtext/errors_internal.rb

Instance Attribute Summary

Attributes inherited from ParseError

#colno, #lineno, #message_raw

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ ParseInvalidIndentationCharError

Returns a new instance of ParseInvalidIndentationCharError.



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/nestedtext/errors_internal.rb', line 148

def initialize(line)
  printable_char = line.content[0].dump.gsub(/"/, "")

  # Looking for non-breaking space is just to be compatialbe with official tests.
  explanation = ""
  if printable_char == '\\u00A0'
    printable_char = '\\xa0'
    explanation = " (NO-BREAK SPACE)"
  end

  message = "invalid character in indentation: '#{printable_char}'#{explanation}."
  super(line, line.indentation, message)
end