Class: Jade::Parsing::Error
Direct Known Subclasses
EOFError, InvalidOperatorError, MissingThenError, UnexpectedTokenError
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Attributes inherited from Error
Instance Method Summary collapse
- #commit ⇒ Object
- #committed? ⇒ Boolean
-
#initialize(entry:, span:, actual:, expected:, committed: false, context: []) ⇒ Error
constructor
A new instance of Error.
- #with_context(name) ⇒ Object
Methods inherited from Error
#candidates, #label, #message, #notes, #queried_name, #to_diagnostic
Constructor Details
#initialize(entry:, span:, actual:, expected:, committed: false, context: []) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 12 13 |
# File 'lib/jade/parsing/error.rb', line 7 def initialize(entry:, span:, actual:, expected:, committed: false, context: []) super(entry:, span:) @actual = actual @expected = expected @committed = committed @context = context end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
35 36 37 |
# File 'lib/jade/parsing/error.rb', line 35 def actual @actual end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
35 36 37 |
# File 'lib/jade/parsing/error.rb', line 35 def context @context end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
35 36 37 |
# File 'lib/jade/parsing/error.rb', line 35 def expected @expected end |
Instance Method Details
#commit ⇒ Object
19 20 21 22 |
# File 'lib/jade/parsing/error.rb', line 19 def commit @committed = true self end |
#committed? ⇒ Boolean
15 16 17 |
# File 'lib/jade/parsing/error.rb', line 15 def committed? @committed end |
#with_context(name) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jade/parsing/error.rb', line 24 def with_context(name) self.class.new( entry: @entry, span: @span, actual: @actual, expected: @expected, committed: @committed, context: [name, *@context], ) end |