Class: Clavius::Configuration

Inherits:
Object
  • Object
show all
Includes:
Memoizable
Defined in:
lib/clavius/configuration.rb

Defined Under Namespace

Classes: Raw

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
# File 'lib/clavius/configuration.rb', line 6

def initialize
  @raw = Raw.new.tap do |raw| yield raw if block_given? end
end

Instance Method Details

#excludedObject



24
25
26
27
28
29
# File 'lib/clavius/configuration.rb', line 24

def excluded
  raw.excluded
    .select { |date| date.respond_to?(:to_date) }
    .map(&:to_date)
    .to_set
end

#includedObject



17
18
19
20
21
22
# File 'lib/clavius/configuration.rb', line 17

def included
  raw.included
    .select { |date| date.respond_to?(:to_date) }
    .map(&:to_date)
    .to_set
end

#weekdaysObject



10
11
12
13
14
15
# File 'lib/clavius/configuration.rb', line 10

def weekdays
  raw.weekdays
    .select(&Time::WEEKDAYS.method(:include?))
    .map(&Time::WEEKDAYS.method(:index))
    .to_set
end