Class: Stencil::Directive::Source
- Inherits:
-
Object
- Object
- Stencil::Directive::Source
- Defined in:
- lib/stencil/directives/base.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #exception(based_on = nil) ⇒ Object
-
#initialize(file, line, column) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
Constructor Details
#initialize(file, line, column) ⇒ Source
Returns a new instance of Source.
5 6 7 |
# File 'lib/stencil/directives/base.rb', line 5 def initialize(file, line, column) @file, @line, @column = file, line, column end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
9 10 11 |
# File 'lib/stencil/directives/base.rb', line 9 def column @column end |
#file ⇒ Object
Returns the value of attribute file.
9 10 11 |
# File 'lib/stencil/directives/base.rb', line 9 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
9 10 11 |
# File 'lib/stencil/directives/base.rb', line 9 def line @line end |
Instance Method Details
#exception(based_on = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stencil/directives/base.rb', line 15 def exception(based_on=nil) = case based_on when String based_on when ::Exception [based_on.class, based_on., based_on.backtrace.first].join(": ") else "resulting from #{based_on}.inspect" end re = RenderError.new() re.line = @line re.column = @column re.file = @file re end |
#inspect ⇒ Object
11 12 13 |
# File 'lib/stencil/directives/base.rb', line 11 def inspect "#{@file}:#{@line},#{@column}" end |