Class: VagrantPlugins::TimeZone::Config
- Inherits:
-
Vagrant::Plugin::V2::Config
- Object
- Vagrant::Plugin::V2::Config
- VagrantPlugins::TimeZone::Config
- Defined in:
- lib/vagrant-timezone/config.rb,
lib/vagrant-timezone/config.rb
Overview
Configuration for the Time Zone plugin
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 |
# File 'lib/vagrant-timezone/config.rb', line 11 def initialize super @value = UNSET_VALUE end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/vagrant-timezone/config.rb', line 9 def value @value end |
Instance Method Details
#finalize! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vagrant-timezone/config.rb', line 17 def finalize! super if @value == UNSET_VALUE @value = nil elsif @value == :host # Get the offset of the current timezone of the host. Ruby doesn't reliably # detect the named timezone, so we have to use the hour offset. Note that when # DST changes, etc, this offset will change. # We set timezone offset negative to match POSIX standards # https://github.com/eggert/tz/blob/master/etcetera @value = format('Etc/GMT%+d', -(Time.now.utc_offset / 3600)) end end |