Exception: Puffy::PuffyError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Puffy::PuffyError
- Defined in:
- lib/puffy.rb
Overview
Base class for application errors with a configuration file
Direct Known Subclasses
Instance Method Summary collapse
- #extra ⇒ Object
- #filename ⇒ Object
-
#initialize(message, token) ⇒ PuffyError
constructor
A new instance of PuffyError.
- #length ⇒ Object
- #line ⇒ Object
- #lineno ⇒ Object
- #position ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message, token) ⇒ PuffyError
Returns a new instance of PuffyError.
20 21 22 23 |
# File 'lib/puffy.rb', line 20 def initialize(, token) super() @token = token end |
Instance Method Details
#extra ⇒ Object
45 46 47 |
# File 'lib/puffy.rb', line 45 def extra '~' * (length - 1) end |
#filename ⇒ Object
25 26 27 |
# File 'lib/puffy.rb', line 25 def filename @token[:filename] end |
#length ⇒ Object
41 42 43 |
# File 'lib/puffy.rb', line 41 def length @token.fetch(:length, 1) end |
#line ⇒ Object
33 34 35 |
# File 'lib/puffy.rb', line 33 def line @token[:line] end |
#lineno ⇒ Object
29 30 31 |
# File 'lib/puffy.rb', line 29 def lineno @token[:lineno] end |
#position ⇒ Object
37 38 39 |
# File 'lib/puffy.rb', line 37 def position @token[:position] end |
#to_s ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/puffy.rb', line 49 def to_s <<~MESSAGE #{filename}:#{lineno}:#{position + 1}: #{super} #{line} #{' ' * position}^#{extra} MESSAGE end |