Class: Emendate::EdtfSetHandler

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ EdtfSetHandler

Returns a new instance of EdtfSetHandler.



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

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

Class Method Details

.callObject



9
10
11
# File 'lib/emendate/edtf_set_handler.rb', line 9

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

Instance Method Details

#callObject



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

def call
  return Success(result) unless alternate_set? || inclusive_set?

  if alternate_set?
    _alt = yield handle_set(:alternate)
  elsif inclusive_set?
    _inc = yield handle_set(:inclusive)
  end

  Success(result)
end