Sha256: ff88826b2f2a95adb4500688b5c933795765b00d92df6227a62f4d20e03e40bd

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

module TimeCrisis
  module TZInfo
    # The timezone index file includes TimezoneIndexDefinition which provides
    # methods used to define timezones in the index.
    module TimezoneIndexDefinition #:nodoc:
      def self.append_features(base)
        super
        base.extend(ClassMethods)
        base.instance_eval do
          @timezones = []
          @data_timezones = []
          @linked_timezones = []
        end
      end

      module ClassMethods #:nodoc:
        # Defines a timezone based on data.
        def timezone(identifier)
          @timezones << identifier
          @data_timezones << identifier
        end

        # Defines a timezone which is a link to another timezone.
        def linked_timezone(identifier)
          @timezones << identifier
          @linked_timezones << identifier
        end

        # Returns a frozen array containing the identifiers of all the timezones.
        # Identifiers appear in the order they were defined in the index.
        def timezones
          @timezones.freeze
        end

        # Returns a frozen array containing the identifiers of all data timezones.
        # Identifiers appear in the order they were defined in the index.
        def data_timezones
          @data_timezones.freeze
        end

        # Returns a frozen array containing the identifiers of all linked
        # timezones. Identifiers appear in the order they were defined in
        # the index.
        def linked_timezones
          @linked_timezones.freeze
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
time_crisis-0.3.5 lib/time_crisis/tzinfo/timezone_index_definition.rb
time_crisis-0.3.2 lib/time_crisis/tzinfo/timezone_index_definition.rb
time_crisis-0.3.1 lib/time_crisis/tzinfo/timezone_index_definition.rb
time_crisis-0.3.0 lib/time_crisis/tzinfo/timezone_index_definition.rb