diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-03-30 23:49:52 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-03-30 23:49:52 +0000 |
commit | 2ccfcc42b0f8a6906213ee6b61c7c53466c0b41d (patch) | |
tree | 8ca47aa8fc0608c5ee75c5cbebd6daa190f54119 /activesupport | |
parent | 9c124a98b37f9ae121dd39e90ad5775460c64f73 (diff) | |
download | rails-2ccfcc42b0f8a6906213ee6b61c7c53466c0b41d.tar.gz rails-2ccfcc42b0f8a6906213ee6b61c7c53466c0b41d.tar.bz2 rails-2ccfcc42b0f8a6906213ee6b61c7c53466c0b41d.zip |
TZInfo: Removing unneeded TimezoneProxy class
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/Rakefile | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_proxy.rb | 85 |
4 files changed, 4 insertions, 87 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 3de6a21247..cd48b01c19 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* TZInfo: Removing unneeded TimezoneProxy class [Geoff Buesing] + * TZInfo: Removing unneeded TimezoneIndexDefinition, since we're not including Indexes::Timezones [Geoff Buesing] * Removing unnecessary uses_tzinfo helper from tests, given that TZInfo is now bundled [Geoff Buesing] diff --git a/activesupport/Rakefile b/activesupport/Rakefile index f89a7d500d..38ca03b658 100644 --- a/activesupport/Rakefile +++ b/activesupport/Rakefile @@ -170,6 +170,6 @@ namespace :tzinfo do end def excluded_classes - %w(country country_index_definition country_info country_timezone timezone_index_definition tzdataparser) + %w(country country_index_definition country_info country_timezone timezone_index_definition timezone_proxy tzdataparser) end end
\ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb index a9ca1575e6..c8bdbeec5d 100644 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb +++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb @@ -28,6 +28,6 @@ $:.unshift(File.dirname(__FILE__)) unless require 'tzinfo/timezone' # require 'tzinfo/country' # require 'tzinfo/tzdataparser' -require 'tzinfo/timezone_proxy' +# require 'tzinfo/timezone_proxy' require 'tzinfo/data_timezone' require 'tzinfo/linked_timezone'
\ No newline at end of file diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_proxy.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_proxy.rb deleted file mode 100644 index f7b2276c07..0000000000 --- a/activesupport/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_proxy.rb +++ /dev/null @@ -1,85 +0,0 @@ -#-- -# Copyright (c) 2005-2006 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 the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -#++ - -require 'tzinfo/timezone' - -module TZInfo - - # A proxy class representing a timezone with a given identifier. TimezoneProxy - # inherits from Timezone and can be treated like any Timezone loaded with - # Timezone.get. - # - # The first time an attempt is made to access the data for the timezone, the - # real Timezone is loaded. If the proxy's identifier was not valid, then an - # exception will be raised at this point. - class TimezoneProxy < Timezone - # Construct a new TimezoneProxy for the given identifier. The identifier - # is not checked when constructing the proxy. It will be validated on the - # when the real Timezone is loaded. - def self.new(identifier) - # Need to override new to undo the behaviour introduced in Timezone#new. - tzp = super() - tzp.send(:setup, identifier) - tzp - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - @real_timezone ? @real_timezone.identifier : @identifier - end - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - def period_for_utc(utc) - real_timezone.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Returns an empty array if no periods are found for the given time. - def periods_for_local(local) - real_timezone.periods_for_local(local) - end - - # Dumps this TimezoneProxy for marshalling. - def _dump(limit) - identifier - end - - # Loads a marshalled TimezoneProxy. - def self._load(data) - TimezoneProxy.new(data) - end - - private - def setup(identifier) - @identifier = identifier - @real_timezone = nil - end - - def real_timezone - @real_timezone ||= Timezone.get(@identifier) - end - end -end |