aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2008-03-21 22:48:00 +0000
committerGeoff Buesing <gbuesing@gmail.com>2008-03-21 22:48:00 +0000
commitf371f292650480dd38d6ad23b5646fba53e472b1 (patch)
tree7043484885d0133f1614113b4ddd1da0bc757b72 /activesupport/lib/active_support/values
parentf2840f508da1e69450551d3e3404cd72a77427e3 (diff)
downloadrails-f371f292650480dd38d6ad23b5646fba53e472b1.tar.gz
rails-f371f292650480dd38d6ad23b5646fba53e472b1.tar.bz2
rails-f371f292650480dd38d6ad23b5646fba53e472b1.zip
Make TimeWithZone work with tzinfo 0.2.x: use TZInfo::Timezone#zone_identifier alias for #abbreviation, silence warnings on tests. Raise LoadError when TZInfo version is < 0.2 by sniffing for TZInfo::TimeOrDateTime constant. Move all tzinfo-dependent TimeZone tests into uses_tzinfo block
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9071 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 085fab9731..91f0394472 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -177,6 +177,7 @@ class TimeZone
begin # the following methods depend on the tzinfo gem
require_library_or_gem "tzinfo" unless Object.const_defined?(:TZInfo)
+ raise LoadError unless TZInfo.const_defined?(:TimeOrDateTime)
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from given values. Example:
#
@@ -253,7 +254,7 @@ class TimeZone
rescue LoadError # Tzinfo gem is not available
# re-raise LoadError only when a tzinfo-dependent method is called:
%w(local at parse now today utc_to_local local_to_utc period_for_utc period_for_local tzinfo).each do |method|
- define_method(method) {|*args| raise LoadError, "TZInfo gem is required for TimeZone##{method}. `gem install tzinfo` and try again."}
+ define_method(method) {|*args| raise LoadError, "TZInfo version >= 0.2 is required for TimeZone##{method}(). `gem install tzinfo` and try again."}
end
end