Class: Emendate::UncertaintyDigits

Inherits:
Segment
  • Object
show all
Includes:
DateUtils
Defined in:
lib/emendate/segment/uncertainty_digits.rb

Instance Method Summary collapse

Methods included from DateUtils

#expand_shorter_digits, #is_range?, #max_season, #min_season, #month_abbr_literal, #month_literal, #possible_range?, #valid_date?, #valid_day?, #valid_month?, #valid_month_or_season?, #valid_season?, #valid_year?

Constructor Details

#initialize(lexeme:, sources: nil) ⇒ UncertaintyDigits

Returns a new instance of UncertaintyDigits.

Parameters:

  • lexeme (String)

    of numerals reflecting how number originally appeared in string (with leading zeroes, etc.)



12
13
14
15
16
17
18
19
20
21
# File 'lib/emendate/segment/uncertainty_digits.rb', line 12

def initialize(lexeme:, sources: nil)
  super(type: :uncertainty_digits, lexeme: lexeme, sources: sources)
  unless lexeme.match?(/^[\-xu?]+$/i)
    raise Emendate::TokenLexemeError,
      "UncertaintyDigits segments must be created with lexemes containing "\
      "only characters allowed as uncertainty digits"
  end

  @digits = lexeme.length
end

Instance Method Details

#to_sObject Also known as: inspect



23
24
25
# File 'lib/emendate/segment/uncertainty_digits.rb', line 23

def to_s
  super
end