Class: Emendate::RangeIndicator

Inherits:
Object
  • Object
show all
Defined in:
lib/emendate/range_indicator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ RangeIndicator

Returns a new instance of RangeIndicator.



13
14
15
16
# File 'lib/emendate/range_indicator.rb', line 13

def initialize(tokens)
  @result = tokens.class.new.copy(tokens)
  @unhandled_mode = Emendate.set_unhandled_mode
end

Class Method Details

.callObject



8
9
10
# File 'lib/emendate/range_indicator.rb', line 8

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

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/emendate/range_indicator.rb', line 18

def call
  kill_unhandled_range_indicators if has_range_indicator? &&
    unhandled_mode == :collapse_unhandled
  collapse_ranges while has_range_indicator?
  validate

  if collapsible_and_or_date?
    collapse_to_range
  end
  Success(result)
end