Exception: Dentaku::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- Dentaku::ParseError
- Defined in:
- lib/dentaku/exceptions.rb
Constant Summary collapse
- VALID_REASONS =
%i[ node_invalid too_few_operands undefined_function unprocessed_token unknown_case_token unbalanced_bracket unbalanced_parenthesis unknown_grouping_token not_implemented_token_category invalid_statement ].freeze
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(reason, **meta) ⇒ ParseError
constructor
A new instance of ParseError.
Constructor Details
#initialize(reason, **meta) ⇒ ParseError
Returns a new instance of ParseError.
25 26 27 28 |
# File 'lib/dentaku/exceptions.rb', line 25 def initialize(reason, **) @reason = reason @meta = end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
23 24 25 |
# File 'lib/dentaku/exceptions.rb', line 23 def @meta end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
23 24 25 |
# File 'lib/dentaku/exceptions.rb', line 23 def reason @reason end |
Class Method Details
.for(reason, **meta) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/dentaku/exceptions.rb', line 39 def self.for(reason, **) unless VALID_REASONS.include?(reason) raise ::ArgumentError, "Unhandled #{reason}" end new reason, end |