Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refer to TZInfo Data as TZInfo::Data.

Changes to documentation.
  • Loading branch information...
commit 1050b2bdeb92dabaa1841afe1d2c30cd169095db 1 parent ec9a120
Phil Ross philr authored
2  LICENSE
View
@@ -1,4 +1,4 @@
-Copyright (c) 2005-2012 Philip Ross
+Copyright (c) 2005-2013 Philip Ross
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
57 README
View
@@ -1,32 +1,48 @@
= TZInfo -- Daylight-savings aware timezone support for Ruby
-TZInfo[http://tzinfo.rubyforge.org] uses the tz database
-(http://www.twinsun.com/tz/tz-link.htm) to provide
-daylight-savings aware transformations between times in different timezones.
-This is the same database as used to create the zoneinfo directory on *nix
-machines.
+TZInfo[http://tzinfo.rubyforge.org] provides daylight-savings aware
+transformations between times in different timezones.
== Data Sources
TZInfo can load data from:
-1. Ruby modules generated from the tz database and included in a separate
- TZInfo Data library.
+1. Ruby modules generated from the IANA Timezone Database and included in the
+ separate TZInfo::Data library (tzinfo-data gem).
2. A zoneinfo directory, typically packaged with your operating system.
-By default the TZInfo Data Ruby modules will be used. If TZInfo Data is not
+By default the TZInfo::Data Ruby modules will be used. If TZInfo::Data is not
available (i.e. if require 'tzinfo/data' fails), then TZInfo will search for
a zoneinfo directory instead (using the paths specified in
TZInfo::ZoneinfoDataSource::DEFAULT_SEARCH_PATHS).
If no data source can be found, a TZInfo::DataSourceNotFound exception will be
-raised when TZInfo is used.
+raised when using TZInfo.
The default data source selection can be overridden using
TZInfo::DataSource.set.
+== Installation
+
+TZInfo can be installed using the gem command:
+
+ $ gem install tzinfo
+
+To use the Ruby modules as the data source, you'll also need to install
+TZInfo::Data:
+
+ $ gem install tzinfo-data
+
+
+== Download
+
+Tar, Zip and RubyGem packages of TZInfo can be downloaded from:
+
+* http://rubyforge.org/frs/?group_id=894
+
+
== Example usage
To convert a time in UTC to a local time in the America/New_York timezone, you
@@ -84,13 +100,6 @@ The above covers the most common uses of Timezone and Country. For more detail,
see the API documentation for the individual classes.
-== Download
-
-The latest version of TZInfo can be found at
-
-* http://rubyforge.org/frs/?group_id=894
-
-
== Documentation
API documentation can be found at
@@ -98,26 +107,14 @@ API documentation can be found at
* http://tzinfo.rubyforge.org/doc/
-== Installation
-
-The preferred method of installing TZInfo is using RubyGems[http://docs.rubygems.org/]:
-
- % gem install tzinfo
-
-To use the Ruby modules as the data source, you'll also need to install
-TZInfo Data:
-
- % gem install tzinfo-data
-
-
== License
-TZInfo is released under the MIT[http://opensource.org/licenses/mit-license.html] license.
+TZInfo is released under the MIT license, see LICENSE for details.
== Support
-Please post to the TZInfo Users mailing list (http://rubyforge.org/mailman/listinfo/tzinfo-users)
+Please post to the {TZInfo Users mailing list}[http://rubyforge.org/mailman/listinfo/tzinfo-users]
if you require assistance or have any suggestions.
Alternatively, you can contact the author Philip Ross directly at phil.ross@gmail.com.
2  Rakefile
View
@@ -36,7 +36,7 @@ end
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc'
- rdoc.title = "TZInfo Data"
+ rdoc.title = 'TZInfo'
rdoc.options.concat spec.rdoc_options
rdoc.rdoc_files.include(spec.extra_rdoc_files)
rdoc.rdoc_files.include('lib')
35 lib/tzinfo/data_source.rb
View
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2012 Philip Ross
+# Copyright (c) 2012-2013 Philip Ross
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -47,46 +47,47 @@ def self.get
# Sets the currently selected data source for Timezone and Country data.
#
- # This should usually be set to one of the standard data source types:
+ # This should usually be set to one of the two standard data source types:
#
- # :ruby - read data from the Ruby modules included with TZInfo
- # :zoneinfo - read data from the zoneinfo files included with most
- # *nix distributions (e.g. in /usr/share/zoneinfo)
+ # * +:ruby+ - read data from the Ruby modules included in the TZInfo::Data
+ # library (tzinfo-data gem).
+ # * +:zoneinfo+ - read data from the zoneinfo files included with most
+ # Unix-like operating sytems (e.g. in /usr/share/zoneinfo).
#
# To set TZInfo to use one of the standard data source types, call
- # DataSource.set in one of the following ways:
+ # \TZInfo::DataSource.set in one of the following ways:
#
# TZInfo::DataSource.set(:ruby)
# TZInfo::DataSource.set(:zoneinfo)
# TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir)
#
- # DataSource.set(:zoneinfo) will automatically search for the zoneinfo
+ # \DataSource.set(:zoneinfo) will automatically search for the zoneinfo
# directory by checking the paths specified in
# ZoneinfoDataSource.search_paths. ZoneinfoDirectoryNotFound will be raised
# if no valid zoneinfo directory could be found.
#
- # DataSource.set(:zoneinfo, zoneinfo_dir) uses the specified zoneinfo
+ # \DataSource.set(:zoneinfo, zoneinfo_dir) uses the specified zoneinfo
# directory as the data source. If the directory is not a valid zoneinfo
# directory, an InvalidZoneinfoDirectory exception will be raised.
#
# You can create your own custom data source class. It must extend from
# TZInfo::DataSource and implement the following methods:
#
- # load_timezone_info
- # timezone_identifiers
- # data_timezone_identifiers
- # linked_timezone_identifiers
- # load_country_info
- # country_codes
+ # * \load_timezone_info
+ # * \timezone_identifiers
+ # * \data_timezone_identifiers
+ # * \linked_timezone_identifiers
+ # * \load_country_info
+ # * \country_codes
#
- # To make TZInfo use your data source, call DataSource.set as follows:
+ # To make TZInfo use your data source, call \DataSource.set as follows:
#
# TZInfo::DataSource.set(MyDataSource.new)
#
- # To avoid inconsistent data, if DataSource.set is used, it should be
+ # To avoid inconsistent data, if \DataSource.set is used, it should be
# called before accessing any Timezone or Country data.
#
- # If DataSource.set is not called, the included Ruby data modules will be
+ # If \DataSource.set is not called, the included Ruby data modules will be
# used as a data source.
def self.set(data_source_or_type, *args)
if data_source_or_type.kind_of?(DataSource)
10 lib/tzinfo/ruby_data_source.rb
View
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2012 Philip Ross
+# Copyright (c) 2012-2013 Philip Ross
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -21,12 +21,12 @@
#++
module TZInfo
- # A DataSource that loads data from the set of Ruby modules included with
- # TZInfo.
+ # A DataSource that loads data from the set of Ruby modules included in the
+ # TZInfo::Data library (tzinfo-data gem).
#
- # To use this DataSource, do the following:
+ # To have TZInfo use this DataSource, you can do the following:
#
- # TZInfo::DataSource.set(:ruby)
+ # TZInfo::DataSource.set(:ruby)
class RubyDataSource < DataSource
# Base path for require.
REQUIRE_PATH = File.join('tzinfo', 'data', 'definitions')
11 lib/tzinfo/zoneinfo_data_source.rb
View
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2012 Philip Ross
+# Copyright (c) 2012-2013 Philip Ross
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -39,14 +39,15 @@ class ZoneinfoDirectoryNotFound < StandardError
end
# A DataSource that loads data from a 'zoneinfo' directory containing
- # compiled "TZif" version 2 files in addition to zones.tab and iso3166.tab
- # index files.
+ # compiled "TZif" version 2 (or earlier) files in addition to zones.tab
+ # and iso3166.tab index files.
#
- # To load the system zoneinfo files, do the following:
+ # To have TZInfo load the system zoneinfo files, you can do the following:
#
# TZInfo::DataSource.set(:zoneinfo)
#
- # To load zoneinfo files from a particular directory, do the following:
+ # To load zoneinfo files from a particular directory, you can pass the
+ # directory to TZInfo::DataSource.set:
#
# TZInfo::DataSource.set(:zoneinfo, directory)
class ZoneinfoDataSource < DataSource
2  lib/tzinfo/zoneinfo_timezone_info.rb
View
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2008-2012 Philip Ross
+# Copyright (c) 2008-2013 Philip Ross
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
2  tzinfo.gemspec
View
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = 'tzinfo'
s.version = '1.0.0.pre1'
s.summary = 'Daylight-savings aware timezone library'
- s.description = 'TZInfo is a Ruby library that uses the standard tz (Olson) database to provide daylight savings aware transformations between times in different time zones.'
+ s.description = 'TZInfo is a Ruby library that provides daylight savings aware transformations between times in different time zones.'
s.author = 'Philip Ross'
s.email = 'phil.ross@gmail.com'
s.homepage = 'http://tzinfo.rubyforge.org'
Please sign in to comment.
Something went wrong with that request. Please try again.