Class: Emendate::ShortYearHandler

Inherits:
Object
  • Object
show all
Includes:
DateUtils
Defined in:
lib/emendate/short_year_handler.rb

Class Method Summary collapse

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(year) ⇒ ShortYearHandler

Returns a new instance of ShortYearHandler.



15
16
17
# File 'lib/emendate/short_year_handler.rb', line 15

def initialize(year)
  @orig = year
end

Class Method Details

.call(year) ⇒ Object



10
11
12
# File 'lib/emendate/short_year_handler.rb', line 10

def call(year)
  new(year).call
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/emendate/short_year_handler.rb', line 19

def call
  Emendate::Segment.new(type: :year,
    lexeme: orig.lexeme,
    literal: full_year,
    sources: [orig])
end