Exception: NestedText::Errors::ParseInvalidIndentationError
- Inherits:
-
ParseError
- Object
- StandardError
- NestedText::Error
- InternalError
- ParseError
- NestedText::Errors::ParseInvalidIndentationError
- Defined in:
- lib/nestedtext/errors_internal.rb
Instance Attribute Summary
Attributes inherited from ParseError
Instance Method Summary collapse
-
#initialize(line, ind_exp) ⇒ ParseInvalidIndentationError
constructor
A new instance of ParseInvalidIndentationError.
Constructor Details
#initialize(line, ind_exp) ⇒ ParseInvalidIndentationError
Returns a new instance of ParseInvalidIndentationError.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/nestedtext/errors_internal.rb', line 133 def initialize(line, ind_exp) prev_line = line.prev = if prev_line.nil? && ind_exp.zero? 'top-level content must start in column 1.' elsif !prev_line.nil? && line.indentation < prev_line.indentation # Can't use ind_exp here, because it's a difference if the previous line was further indented. # See test_load_error_dict_10 'invalid indentation, partial dedent.' else 'invalid indentation.' end # Official-tests kludge; Need to wrap like official tests. #wrap always add an extra \n we need to chop off. # Seems not be needed anymore # message_wrapped = message.wrap(70).chop super(line, ind_exp, ) end |