Module: Blackcal

Defined in:
lib/blackcal.rb,
lib/blackcal/builder.rb,
lib/blackcal/version.rb,
lib/blackcal/schedule.rb,
lib/blackcal/time_util.rb,
lib/blackcal/array_util.rb,
lib/blackcal/slot_matrix.rb,
lib/blackcal/time_of_day.rb,
lib/blackcal/range/day_range.rb,
lib/blackcal/range/time_range.rb,
lib/blackcal/range/month_range.rb,
lib/blackcal/range/weekday_range.rb,
lib/blackcal/range/time_of_day_range.rb,
lib/blackcal/range/weeks_of_month_range.rb

Overview

Main module

Defined Under Namespace

Modules: ArrayUtil, TimeUtil Classes: Builder, DayRange, MonthRange, Schedule, SlotMatrix, TimeOfDay, TimeOfDayRange, TimeRange, WeekdayRange, WeeksOfMonthRange

Constant Summary collapse

VERSION =

Gem version

'0.5.0'.freeze

Class Method Summary collapse

Class Method Details

.schedule(**keyword_args, &block) ⇒ Schedule

Initialize schedule

Examples:

All options – using method arguments

schedule = Blackcal.schedule(
  months: [:january],
  weeks_of_month: [3],
  weekdays: [:monday, :tuesday],
  start_time_of_day: 18,
  finish_hour_of_day: 7,
  days: (15..25).to_a
)

All options – using block builder

schedule = Blackcal.schedule do
  months [:january]
  weeks_of_month [3]
  weekdays [:monday, :tuesday]
  start_time_of_day 18
  finish_hour_of_day 7
  days (15..25).to_a
end

Returns:

See Also:



31
32
33
34
35
# File 'lib/blackcal.rb', line 31

def self.schedule(**keyword_args, &block)
  schedule_args = keyword_args
  schedule_args.merge!(Builder.dsl(&block).to_h) if block
  Schedule.new(schedule_args)
end