Class: BellyWash::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/belly_wash/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  @separator = '::'
  @ranges = %i[minute hour day week month quarter year]
  @beginning_of_week = :monday
end

Instance Attribute Details

#beginning_of_weekObject

Returns the value of attribute beginning_of_week.



7
8
9
# File 'lib/belly_wash/configuration.rb', line 7

def beginning_of_week
  @beginning_of_week
end

#driverObject

Returns the value of attribute driver.



7
8
9
# File 'lib/belly_wash/configuration.rb', line 7

def driver
  @driver
end

#separatorObject

Returns the value of attribute separator.



7
8
9
# File 'lib/belly_wash/configuration.rb', line 7

def separator
  @separator
end

#time_zoneObject

Returns the value of attribute time_zone.



7
8
9
# File 'lib/belly_wash/configuration.rb', line 7

def time_zone
  @time_zone
end

#track_rangesObject

Returns the value of attribute track_ranges.



7
8
9
# File 'lib/belly_wash/configuration.rb', line 7

def track_ranges
  @track_ranges
end

Instance Method Details

#rangesObject



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

def ranges
  return @ranges if blank?(track_ranges)

  @ranges & track_ranges
end

#tzObject



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

def tz
  TZInfo::Timezone.get(@time_zone)
rescue TZInfo::InvalidTimezoneIdentifier => e
  puts "BellyWash: #{e} - #{time_zone_name}; Defaulting to GMT."

  TZInfo::Timezone.get('GMT')
end