class Liquid::Error
Attributes
line_number[RW]
markup_context[RW]
Public Class Methods
render(e)
click to toggle source
# File lib/liquid/errors.rb, line 25 def self.render(e) if e.is_a?(Liquid::Error) e.to_s else "Liquid error: #{e.to_s}" end end
Public Instance Methods
set_line_number_from_token(token)
click to toggle source
# File lib/liquid/errors.rb, line 19 def set_line_number_from_token(token) return unless token.respond_to?(:line_number) return if self.line_number self.line_number = token.line_number end
to_s(with_prefix=true)
click to toggle source
Calls superclass method
# File lib/liquid/errors.rb, line 6 def to_s(with_prefix=true) str = "" str << message_prefix if with_prefix str << super() if markup_context str << " " str << markup_context end str end
Private Instance Methods
message_prefix()
click to toggle source
# File lib/liquid/errors.rb, line 35 def message_prefix str = "" if is_a?(SyntaxError) str << "Liquid syntax error" else str << "Liquid error" end if line_number str << " (line #{line_number})" end str << ": " str end