Class: ActionView::SyntaxErrorInTemplate
- Inherits:
-
TemplateError
- Object
- ActionView::SyntaxErrorInTemplate
- Defined in:
- lib/action_view/template/error.rb
Overview
:nodoc:
Instance Method Summary collapse
- #annotated_source_code ⇒ Object
-
#initialize(template, offending_code_string) ⇒ SyntaxErrorInTemplate
constructor
A new instance of SyntaxErrorInTemplate.
- #message ⇒ Object
Constructor Details
#initialize(template, offending_code_string) ⇒ SyntaxErrorInTemplate
Returns a new instance of SyntaxErrorInTemplate.
246 247 248 249 |
# File 'lib/action_view/template/error.rb', line 246 def initialize(template, offending_code_string) @offending_code_string = offending_code_string super(template) end |
Instance Method Details
#annotated_source_code ⇒ Object
257 258 259 260 261 262 |
# File 'lib/action_view/template/error.rb', line 257 def annotated_source_code @offending_code_string.split("\n").map.with_index(1) { |line, index| indentation = " " * 4 "#{index}:#{indentation}#{line}" } end |
#message ⇒ Object
251 252 253 254 255 |
# File 'lib/action_view/template/error.rb', line 251 def <<~MESSAGE Encountered a syntax error while rendering template: check #{@offending_code_string} MESSAGE end |