Exception: Twig::Error::Base
- Inherits:
-
StandardError
- Object
- StandardError
- Twig::Error::Base
- Defined in:
- lib/twig/error/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#lineno ⇒ Object
readonly
Returns the value of attribute lineno.
Instance Method Summary collapse
-
#initialize(message, lineno = -1,, source = nil) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(message, lineno = -1,, source = nil) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/twig/error/base.rb', line 11 def initialize(, lineno = -1, source = nil) super() if source name = source.name @source_code = source.code @source_path = source.path else name = nil end @lineno = lineno @name = name = end |
Instance Attribute Details
#lineno ⇒ Object (readonly)
Returns the value of attribute lineno.
6 7 8 |
# File 'lib/twig/error/base.rb', line 6 def lineno @lineno end |
Instance Method Details
#to_s ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/twig/error/base.rb', line 27 def to_s parts = [] parts << [" in #{@name}"] if @name parts << [":#{@lineno}"] if @name && @lineno parts << [" on line #{@lineno}"] if !@name && @lineno parts.join end |