Class: Jade::Parsing::InvalidOperatorError

Inherits:
Error
  • Object
show all
Defined in:
lib/jade/parsing/error.rb

Constant Summary collapse

HINTS =
{
  '/=' => 'Use `!=` for inequality.',
}.freeze

Instance Attribute Summary

Attributes inherited from Error

#actual, #context, #expected

Instance Method Summary collapse

Methods inherited from Error

#commit, #committed?, #with_context

Constructor Details

#initialize(entry:, span:, actual:, expected: nil, committed: true, context: []) ⇒ InvalidOperatorError

Returns a new instance of InvalidOperatorError.



160
161
162
# File 'lib/jade/parsing/error.rb', line 160

def initialize(entry:, span:, actual:, expected: nil, committed: true, context: [])
  super
end

Instance Method Details

#hintObject



164
165
166
# File 'lib/jade/parsing/error.rb', line 164

def hint
  HINTS[actual.value]
end

#messageObject



168
169
170
# File 'lib/jade/parsing/error.rb', line 168

def message
  "#{context_prefix}Invalid operator #{actual.value.inspect}.#{" #{hint}" if hint}"
end