diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-22 06:05:52 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-22 06:05:52 -0700 |
commit | ff55924921636c6ddeaea5d08a3587a97cd4e69b (patch) | |
tree | 1cae2b0a3fad3e0280823fc362caebed9752ffd0 /activesupport/lib/active_support | |
parent | 09fa80dd262f6f1f3c767125e8b1150f9022d546 (diff) | |
parent | 9c9f450e4fc0d6650be26b2391999b579771ba50 (diff) | |
download | rails-ff55924921636c6ddeaea5d08a3587a97cd4e69b.tar.gz rails-ff55924921636c6ddeaea5d08a3587a97cd4e69b.tar.bz2 rails-ff55924921636c6ddeaea5d08a3587a97cd4e69b.zip |
Merge pull request #1202 from vatrai/todo_fix
Fix todo Time.xmlschema used instead of Time.parse
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/xml_mini.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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) }, |