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