123456789_123456789_123456789_123456789_123456789_

Class: TZInfo::DataSources::TimezoneInfo Abstract

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
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.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(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.

[ GitHub ]

  
# 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:

  • (String)

    the identifier of the time zone.

[ GitHub ]

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

attr_reader :identifier

Instance Method Details

#create_timezoneTimezone

Returns:

[ GitHub ]

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

def create_timezone
  raise_not_implemented('create_timezone')
end

#inspectString

Returns:

  • (String)

    the internal object state as a programmer-readable String.

[ GitHub ]

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

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

#raise_not_implemented(method_name) (private)

Raises a NotImplementedError.

Parameters:

  • method_name (String)

    the name of the method that must be overridden.

Raises:

  • NotImplementedError always.

[ GitHub ]

  
# File 'lib/tzinfo/data_sources/timezone_info.rb', line 42

def raise_not_implemented(method_name)
  raise NotImplementedError, "Subclasses must override #{method_name}"
end