Exception: Locomotive::Steam::ParsingRenderingError
- Inherits:
-
StandardError
- Object
- StandardError
- Locomotive::Steam::ParsingRenderingError
- Defined in:
- lib/locomotive/steam/errors.rb
Direct Known Subclasses
Constant Summary collapse
- LINES_RANGE =
10
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
-
#original_backtrace ⇒ Object
Returns the value of attribute original_backtrace.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #backtrace ⇒ Object
- #code_lines ⇒ Object
-
#initialize(message, file, source, line, original_backtrace) ⇒ ParsingRenderingError
constructor
A new instance of ParsingRenderingError.
Constructor Details
#initialize(message, file, source, line, original_backtrace) ⇒ ParsingRenderingError
Returns a new instance of ParsingRenderingError.
23 24 25 26 |
# File 'lib/locomotive/steam/errors.rb', line 23 def initialize(, file, source, line, original_backtrace) @file, @source, @line, @original_backtrace = file, source, line, original_backtrace super() end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
21 22 23 |
# File 'lib/locomotive/steam/errors.rb', line 21 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
21 22 23 |
# File 'lib/locomotive/steam/errors.rb', line 21 def line @line end |
#original_backtrace ⇒ Object
Returns the value of attribute original_backtrace.
21 22 23 |
# File 'lib/locomotive/steam/errors.rb', line 21 def original_backtrace @original_backtrace end |
#source ⇒ Object
Returns the value of attribute source.
21 22 23 |
# File 'lib/locomotive/steam/errors.rb', line 21 def source @source end |
Instance Method Details
#backtrace ⇒ Object
40 41 42 |
# File 'lib/locomotive/steam/errors.rb', line 40 def backtrace original_backtrace end |
#code_lines ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/locomotive/steam/errors.rb', line 28 def code_lines return [] if source.blank? || line.nil? lines = source.split("\n") start = line - (LINES_RANGE / 2) start = 1 if start <= 0 finish = line + (LINES_RANGE / 2) (start..finish).map { |i| [i, lines[i - 1]] } end |