Exception: Jrr::TokenizerError
- Inherits:
-
StandardError
- Object
- StandardError
- Jrr::TokenizerError
- Defined in:
- lib/jrr/exceptions.rb
Constant Summary collapse
- VALID_REASONS =
%i[ parse_error too_many_opening_parentheses too_many_closing_parentheses unexpected_zero_width_match ].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) ⇒ TokenizerError
constructor
A new instance of TokenizerError.
Constructor Details
#initialize(reason, **meta) ⇒ TokenizerError
Returns a new instance of TokenizerError.
5 6 7 8 |
# File 'lib/jrr/exceptions.rb', line 5 def initialize(reason, **) @reason = reason @meta = end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
3 4 5 |
# File 'lib/jrr/exceptions.rb', line 3 def @meta end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
3 4 5 |
# File 'lib/jrr/exceptions.rb', line 3 def reason @reason end |
Class Method Details
.for(reason, **meta) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jrr/exceptions.rb', line 17 def self.for(reason, **) unless VALID_REASONS.include?(reason) raise ::ArgumentError, "Unhandled #{reason}" end new reason, end |