class Mongoid::Oslc::QueryParsingError

Attributes

query[RW]

Public Class Methods

new(query = "", index = 0, message = "") click to toggle source
Calls superclass method
# File lib/mongoid/oslc/exceptions.rb, line 13
def initialize(query = "", index = 0, message = "")
  @query = query
  @index = index
  super("Parse error at offset: #{@index} #{highlight_error(@query, @index)}")
end

Protected Instance Methods

highlight_error(str, index) click to toggle source
# File lib/mongoid/oslc/exceptions.rb, line 21
def highlight_error(str, index)
  error_str = "\n#{str}\n"
  (index - 1).times { error_str << "-" }
  error_str << "^"
end