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

Attributes inherited from Error

#entry, #span

Instance Method Summary collapse

Methods inherited from Error

#commit, #committed?, #with_context

Methods inherited from Error

#candidates, #label, #notes, #queried_name, #to_diagnostic

Constructor Details

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

Returns a new instance of InvalidOperatorError.



141
142
143
# File 'lib/jade/parsing/error.rb', line 141

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

Instance Method Details

#hintObject



145
146
147
# File 'lib/jade/parsing/error.rb', line 145

def hint
  HINTS[actual.value]
end

#messageObject



149
150
151
# File 'lib/jade/parsing/error.rb', line 149

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