Class: Trifle::Stats::Configuration
- Inherits:
-
Object
- Object
- Trifle::Stats::Configuration
- Defined in:
- lib/trifle/stats/configuration.rb
Instance Attribute Summary collapse
-
#beginning_of_week ⇒ Object
Returns the value of attribute beginning_of_week.
-
#designator ⇒ Object
Returns the value of attribute designator.
- #driver ⇒ Object
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
-
#track_ranges ⇒ Object
Returns the value of attribute track_ranges.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #ranges ⇒ Object
- #tz ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 |
# File 'lib/trifle/stats/configuration.rb', line 11 def initialize @ranges = %i[minute hour day week month quarter year] @beginning_of_week = :monday @time_zone = 'GMT' @designator = nil end |
Instance Attribute Details
#beginning_of_week ⇒ Object
Returns the value of attribute beginning_of_week.
9 10 11 |
# File 'lib/trifle/stats/configuration.rb', line 9 def beginning_of_week @beginning_of_week end |
#designator ⇒ Object
Returns the value of attribute designator.
9 10 11 |
# File 'lib/trifle/stats/configuration.rb', line 9 def designator @designator end |
#driver ⇒ Object
32 33 34 35 36 |
# File 'lib/trifle/stats/configuration.rb', line 32 def driver raise DriverNotFound if @driver.nil? @driver end |
#time_zone ⇒ Object
Returns the value of attribute time_zone.
9 10 11 |
# File 'lib/trifle/stats/configuration.rb', line 9 def time_zone @time_zone end |
#track_ranges ⇒ Object
Returns the value of attribute track_ranges.
9 10 11 |
# File 'lib/trifle/stats/configuration.rb', line 9 def track_ranges @track_ranges end |
Instance Method Details
#ranges ⇒ Object
26 27 28 29 30 |
# File 'lib/trifle/stats/configuration.rb', line 26 def ranges return @ranges if blank?(track_ranges) @ranges & track_ranges end |
#tz ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/trifle/stats/configuration.rb', line 18 def tz TZInfo::Timezone.get(@time_zone) rescue TZInfo::InvalidTimezoneIdentifier => e puts "Trifle: #{e} - #{time_zone}; Defaulting to GMT." TZInfo::Timezone.get('GMT') end |