class Puffy::PuffyError

Public Class Methods

new(message, token) click to toggle source
Calls superclass method
# File lib/puffy.rb, line 19
def initialize(message, token)
  super(message)
  @token = token
end

Public Instance Methods

extra() click to toggle source
# File lib/puffy.rb, line 44
def extra
  '~' * (length - 1)
end
filename() click to toggle source
# File lib/puffy.rb, line 24
def filename
  @token[:filename]
end
length() click to toggle source
# File lib/puffy.rb, line 40
def length
  @token.fetch(:length, 1)
end
line() click to toggle source
# File lib/puffy.rb, line 32
def line
  @token[:line]
end
lineno() click to toggle source
# File lib/puffy.rb, line 28
def lineno
  @token[:lineno]
end
position() click to toggle source
# File lib/puffy.rb, line 36
def position
  @token[:position]
end
to_s() click to toggle source
# File lib/puffy.rb, line 48
    def to_s
      <<~MESSAGE
        #{filename}:#{lineno}:#{position + 1}: #{super}
        #{line}
        #{' ' * position}^#{extra}
      MESSAGE
    end