Class: AutoTimezone::Sundial
- Inherits:
-
Object
- Object
- AutoTimezone::Sundial
- Defined in:
- lib/auto_timezone/sundial.rb
Class Method Summary collapse
Instance Method Summary collapse
- #current_timezone ⇒ Object
-
#initialize(ctx) ⇒ Sundial
constructor
A new instance of Sundial.
Constructor Details
#initialize(ctx) ⇒ Sundial
Returns a new instance of Sundial.
3 4 5 6 7 |
# File 'lib/auto_timezone/sundial.rb', line 3 def initialize(ctx) @ctx = ctx return if !config.default_timezone_block || @ctx.respond_to?(:auto_timezone_default) @ctx.define_singleton_method :auto_timezone_default, config.default_timezone_block end |
Class Method Details
.preferred_zones ⇒ Object
13 14 15 |
# File 'lib/auto_timezone/sundial.rb', line 13 def self.preferred_zones @preferred_zones ||= AutoTimezone.config.preferred_timezones.map { |z| Time.find_zone(z) } end |
Instance Method Details
#current_timezone ⇒ Object
9 10 11 |
# File 'lib/auto_timezone/sundial.rb', line 9 def current_timezone @current_timezone ||= Time.find_zone(timezone_name) end |