Exception: Enolib::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/enolib/errors.rb

Direct Known Subclasses

ParseError, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, snippet, selection) ⇒ Error

Returns a new instance of Error.



7
8
9
10
11
12
13
# File 'lib/enolib/errors.rb', line 7

def initialize(text, snippet, selection)
  super("#{text}\n\n#{snippet}")

  @selection = selection
  @snippet = snippet
  @text = text
end

Instance Attribute Details

#selectionObject (readonly)

Returns the value of attribute selection.



5
6
7
# File 'lib/enolib/errors.rb', line 5

def selection
  @selection
end

#snippetObject (readonly)

Returns the value of attribute snippet.



5
6
7
# File 'lib/enolib/errors.rb', line 5

def snippet
  @snippet
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/enolib/errors.rb', line 5

def text
  @text
end

Instance Method Details

#cursorObject



15
16
17
# File 'lib/enolib/errors.rb', line 15

def cursor
  @selection[0]
end