Exception: Slaw::Parse::ParseError
- Inherits:
-
Exception
- Object
- Exception
- Slaw::Parse::ParseError
- Defined in:
- lib/slaw/parse/error.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(message, opts) ⇒ ParseError
constructor
A new instance of ParseError.
-
#to_json(g = nil) ⇒ Object
TODO: move this elsewhere, it’s out of context here.
Constructor Details
#initialize(message, opts) ⇒ ParseError
Returns a new instance of ParseError.
6 7 8 9 10 11 |
# File 'lib/slaw/parse/error.rb', line 6 def initialize(, opts) super() self.line = opts[:line] self.column = opts[:column] end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
4 5 6 |
# File 'lib/slaw/parse/error.rb', line 4 def column @column end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/slaw/parse/error.rb', line 4 def line @line end |
Instance Method Details
#to_json(g = nil) ⇒ Object
TODO: move this elsewhere, it’s out of context here
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/slaw/parse/error.rb', line 14 def to_json(g=nil) msg = self. msg = msg[0..200] + '...' if msg.length > 200 { message: msg, line: self.line, column: self.column, }.to_json(g) end |