diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/activesupport.gemspec | 7 | ||||
-rw-r--r-- | activesupport/lib/active_support/i18n.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/xml_mini.rb | 6 |
4 files changed, 9 insertions, 10 deletions
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index f6eb2be5ae..738a10a18f 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -9,12 +9,13 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.8.7' - s.author = 'David Heinemeier Hansson' - s.email = 'david@loudthinking.com' - s.homepage = 'http://www.rubyonrails.org' + s.author = 'David Heinemeier Hansson' + s.email = 'david@loudthinking.com' + s.homepage = 'http://www.rubyonrails.org' s.files = Dir['CHANGELOG', 'README.rdoc', 'lib/**/*'] s.require_path = 'lib' + s.add_dependency('i18n', '~> 0.6') s.add_dependency('multi_json', '~> 1.0') end diff --git a/activesupport/lib/active_support/i18n.rb b/activesupport/lib/active_support/i18n.rb index 00ea8813dd..f9c5e5e2f8 100644 --- a/activesupport/lib/active_support/i18n.rb +++ b/activesupport/lib/active_support/i18n.rb @@ -2,7 +2,7 @@ begin require 'i18n' require 'active_support/lazy_load_hooks' rescue LoadError => e - $stderr.puts "You don't have i18n installed in your application. Please add it to your Gemfile and run bundle install" + $stderr.puts "The i18n gem is not available. Please add it to your Gemfile and run bundle install" raise e end diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index abd585b64f..728921a069 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -315,10 +315,8 @@ module ActiveSupport tzinfo.period_for_local(time, dst) end - # TODO: Preload instead of lazy load for thread safety def self.find_tzinfo(name) - require 'active_support/tzinfo' unless defined?(::TZInfo) - ::TZInfo::TimezoneProxy.new(MAPPING[name] || name) + TZInfo::TimezoneProxy.new(MAPPING[name] || name) end class << self diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb index 6e12404ad4..1ea9a9d7e1 100644 --- a/activesupport/lib/active_support/xml_mini.rb +++ b/activesupport/lib/active_support/xml_mini.rb @@ -1,3 +1,4 @@ +require 'time' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/string/inflections' @@ -51,13 +52,12 @@ module ActiveSupport "yaml" => Proc.new { |yaml| yaml.to_yaml } } unless defined?(FORMATTING) - # TODO: use Time.xmlschema instead of Time.parse; - # use regexp instead of Date.parse + # TODO use regexp instead of Date.parse unless defined?(PARSING) PARSING = { "symbol" => Proc.new { |symbol| symbol.to_sym }, "date" => Proc.new { |date| ::Date.parse(date) }, - "datetime" => Proc.new { |time| ::Time.parse(time).utc rescue ::DateTime.parse(time).utc }, + "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc }, "integer" => Proc.new { |integer| integer.to_i }, "float" => Proc.new { |float| float.to_f }, "decimal" => Proc.new { |number| BigDecimal(number) }, |