Class: Trifle::Ruby::Configuration
- Inherits:
-
Object
- Object
- Trifle::Ruby::Configuration
- Defined in:
- lib/trifle/ruby/configuration.rb
Instance Attribute Summary collapse
-
#beginning_of_week ⇒ Object
Returns the value of attribute beginning_of_week.
- #driver ⇒ Object
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#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.
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_week ⇒ Object
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 |
#driver ⇒ Object
33 34 35 36 37 |
# File 'lib/trifle/ruby/configuration.rb', line 33 def driver raise DriverNotFound if @driver.nil? @driver end |
#separator ⇒ Object
Returns the value of attribute separator.
9 10 11 |
# File 'lib/trifle/ruby/configuration.rb', line 9 def separator @separator end |
#time_zone ⇒ Object
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_ranges ⇒ Object
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
#ranges ⇒ Object
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 |
#tz ⇒ Object
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 |