Class: Availabiliter

Inherits:
Object
  • Object
show all
Defined in:
lib/availabiliter.rb,
lib/availabiliter/errors.rb,
lib/availabiliter/version.rb,
lib/availabiliter/time_slot.rb,
lib/availabiliter/input_formatter.rb,
lib/availabiliter/output_formatter.rb,
lib/availabiliter/options_validator.rb,
lib/availabiliter/time_slot_collection.rb,
lib/availabiliter/availabilities_calculator.rb

Overview

Availabilityer main class and namespace

Defined Under Namespace

Classes: AvailabilitiesCalculator, Error, IncorrectInput, InputFormatter, OptionsValidator, OutputFormatter, TimeSlot, TimeSlotCollection

Constant Summary collapse

PROCESSABLE_FORMATS =
%i[time integer].freeze
DEFAULT_FORMAT =
:integer
PROCESSABLE_TIME_CLASSES =
[Date, Time, Integer, Float].freeze
VERSION =
"1.1.1"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_time_slots, options) ⇒ Availabiliter

Returns a new instance of Availabiliter.



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

def initialize(raw_time_slots, options)
  @options = default_options.merge(options)
  @raw_time_slots = raw_time_slots

  validate_options
end

Class Method Details

.call(raw_time_slots, **options) ⇒ Object



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

def call(raw_time_slots, **options)
  new(raw_time_slots, options).calculate
end

Instance Method Details

#calculateObject



26
27
28
# File 'lib/availabiliter.rb', line 26

def calculate
  AvailabilitiesCalculator.new(raw_time_slots, **options).call
end