Class: TZInfo::DataSources::TimezoneInfo Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/tzinfo/data_sources/timezone_info.rb

Overview

This class is abstract.

Data sources return instances of TimezoneInfo subclasses.

Represents a time zone defined by a data source.

Direct Known Subclasses

DataTimezoneInfo, LinkedTimezoneInfo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ TimezoneInfo

Initializes a new TimezoneInfo. The passed in identifier instance will be frozen.

Parameters:

  • identifier (String)

    the identifier of the time zone.

Raises:

  • (ArgumentError)

    if identifier is nil.


18
19
20
21
# File 'lib/tzinfo/data_sources/timezone_info.rb', line 18

def initialize(identifier)
  raise ArgumentError, 'identifier must be specified' unless identifier
  @identifier = identifier.freeze
end

Instance Attribute Details

#identifierString (readonly)

Returns the identifier of the time zone.

Returns:

  • (String)

    the identifier of the time zone.


11
12
13
# File 'lib/tzinfo/data_sources/timezone_info.rb', line 11

def identifier
  @identifier
end

Instance Method Details

#create_timezoneTimezone

Returns a new Timezone instance for the time zone represented by this TZInfo::DataSources::TimezoneInfo.

Returns:


31
32
33
# File 'lib/tzinfo/data_sources/timezone_info.rb', line 31

def create_timezone
  raise_not_implemented('create_timezone')
end

#inspectString

Returns the internal object state as a programmer-readable String.

Returns:

  • (String)

    the internal object state as a programmer-readable String.


25
26
27
# File 'lib/tzinfo/data_sources/timezone_info.rb', line 25

def inspect
  "#<#{self.class}: #@identifier>"
end