Class: Trifle::Ruby::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
# File 'lib/trifle/ruby/configuration.rb', line 12

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

Instance Attribute Details

#beginning_of_weekObject

Returns the value of attribute beginning_of_week.



9
10
11
# File 'lib/trifle/ruby/configuration.rb', line 9

def beginning_of_week
  @beginning_of_week
end

#driverObject

Raises:



33
34
35
36
37
# File 'lib/trifle/ruby/configuration.rb', line 33

def driver
  raise DriverNotFound if @driver.nil?

  @driver
end

#separatorObject

Returns the value of attribute separator.



9
10
11
# File 'lib/trifle/ruby/configuration.rb', line 9

def separator
  @separator
end

#time_zoneObject

Returns the value of attribute time_zone.



9
10
11
# File 'lib/trifle/ruby/configuration.rb', line 9

def time_zone
  @time_zone
end

#track_rangesObject

Returns the value of attribute track_ranges.



9
10
11
# File 'lib/trifle/ruby/configuration.rb', line 9

def track_ranges
  @track_ranges
end

Instance Method Details

#rangesObject



27
28
29
30
31
# File 'lib/trifle/ruby/configuration.rb', line 27

def ranges
  return @ranges if blank?(track_ranges)

  @ranges & track_ranges
end

#tzObject



19
20
21
22
23
24
25
# File 'lib/trifle/ruby/configuration.rb', line 19

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

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