class NestedText::Errors::ParseInvalidIndentationError

Public Class Methods

new(line, ind_exp) click to toggle source
Calls superclass method NestedText::Errors::ParseError::new
# File lib/nestedtext/errors_internal.rb, line 133
def initialize(line, ind_exp)
  prev_line = line.prev
  message = 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, message)
end