Class: Emendate::UntokenizableTagger
- Inherits:
-
Object
- Object
- Emendate::UntokenizableTagger
- Defined in:
- lib/emendate/untokenizable_tagger.rb
Overview
If :final_check_failure_handling option = :failure, returns a single DateTypes::Error with error type :untokenizble if date string matches a known unsupported pattern
If :final_check_failure_handling option = :collapse_unhandled or :collapse_unhandled_first_date, tags untokenizable sequences as such and sets warning, but does not fail.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(tokens) ⇒ UntokenizableTagger
constructor
A new instance of UntokenizableTagger.
Constructor Details
#initialize(tokens) ⇒ UntokenizableTagger
Returns a new instance of UntokenizableTagger.
20 21 22 23 24 |
# File 'lib/emendate/untokenizable_tagger.rb', line 20 def initialize(tokens) @tokens = tokens @result = tokens.class.new.copy(tokens) @failure_mode = Emendate.set_unhandled_mode end |
Class Method Details
.call ⇒ Object
15 16 17 |
# File 'lib/emendate/untokenizable_tagger.rb', line 15 def call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/emendate/untokenizable_tagger.rb', line 26 def call return Success(tokens) unless untokenizable? case failure_mode when :failure process_as_failure when :collapse_unhandled process_as_warning end end |