class TZInfo::DataSources::TimezoneInfo

Represents a time zone defined by a data source.

@abstract Data sources return instances of {TimezoneInfo} subclasses.

Attributes

identifier[R]

@return [String] the identifier of the time zone.

Public Class Methods

new(identifier) click to toggle source

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

@param identifier [String] the identifier of the time zone. @raise [ArgumentError] if `identifier` is `nil`.

# 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

Public Instance Methods

create_timezone() click to toggle source

@return [Timezone] a new {Timezone} instance for the time zone

represented by this {TimezoneInfo}.
# File lib/tzinfo/data_sources/timezone_info.rb, line 31
def create_timezone
  raise_not_implemented('create_timezone')
end
inspect() click to toggle source

@return [String] the internal object state as a programmer-readable

`String`.
# File lib/tzinfo/data_sources/timezone_info.rb, line 25
def inspect
  "#<#{self.class}: #@identifier>"
end

Private Instance Methods

raise_not_implemented(method_name) click to toggle source

Raises a {NotImplementedError}.

@param method_name [String] the name of the method that must be

overridden.

@raise NotImplementedError always.

# File lib/tzinfo/data_sources/timezone_info.rb, line 42
def raise_not_implemented(method_name)
  raise NotImplementedError, "Subclasses must override #{method_name}"
end