Class: PackerFiles::Core::TimeZone

Inherits:
Base
  • Object
show all
Defined in:
lib/PackerFiles/Core/TimeZone.rb

Overview

Define the TimeZone class that can handle TimeZone specified in a Packerfile. Just the barebones attributes that are required for this class are specified here. The conversion of these attributes into a OS build specific file is done by derived classes in the OS specific directories.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ TimeZone

Constructor to just specify accessor varibales

Yields:

  • (_self)

Yield Parameters:



27
28
29
30
# File 'lib/PackerFiles/Core/TimeZone.rb', line 27

def initialize
  @utc      = true
  yield self if block_given?
end

Instance Attribute Details

#autoObject

Returns the value of attribute auto.



19
20
21
# File 'lib/PackerFiles/Core/TimeZone.rb', line 19

def auto
  @auto
end

#utcObject

Specify attributes



17
18
19
# File 'lib/PackerFiles/Core/TimeZone.rb', line 17

def utc
  @utc
end

#zoneObject

Returns the value of attribute zone.



18
19
20
# File 'lib/PackerFiles/Core/TimeZone.rb', line 18

def zone
  @zone
end

Class Method Details

.doc_fileObject

Documentation for this class



22
23
24
# File 'lib/PackerFiles/Core/TimeZone.rb', line 22

def self.doc_file
   PackerFiles.DirPath('Core/example/TimeZone.txt').first
end

Instance Method Details

#normalizeObject

Normalize the various values into something useful. The default implementation checks only errors

Raises:



34
35
36
37
38
39
# File 'lib/PackerFiles/Core/TimeZone.rb', line 34

def normalize
  raise NilException.new(self, 'zone') if @zone.nil? && @auto.nil?
  if (@zone.nil? && @auto)
    @zone = Utils::AutoZone.new.time_zone
  end
end