aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/xml_mini.rb
diff options
context:
space:
mode:
authorBirkir A. Barkarson <birkirb@stoicviking.net>2013-11-13 12:31:02 +0900
committerBirkir A. Barkarson <birkirb@stoicviking.net>2013-12-23 14:04:16 +0900
commit8dd4aca4850c678f96d0a72098b3a080b51dea44 (patch)
tree5a2b480f7831ae1beec4dc59ea557aa7e3df7d50 /activesupport/lib/active_support/xml_mini.rb
parent5542dff88a8581675c9324c8184cc80df99e3325 (diff)
downloadrails-8dd4aca4850c678f96d0a72098b3a080b51dea44.tar.gz
rails-8dd4aca4850c678f96d0a72098b3a080b51dea44.tar.bz2
rails-8dd4aca4850c678f96d0a72098b3a080b51dea44.zip
Fix breakage in XmlMini
- Boolean parsing breaks on non strings (i.e. integer 1|0) - Symbol parsing breaks on non strings. - BigDecimal parsing breaks due to missing require. - Update changelog.
Diffstat (limited to 'activesupport/lib/active_support/xml_mini.rb')
-rw-r--r--activesupport/lib/active_support/xml_mini.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
index d082a0a499..009ee4db90 100644
--- a/activesupport/lib/active_support/xml_mini.rb
+++ b/activesupport/lib/active_support/xml_mini.rb
@@ -1,7 +1,9 @@
require 'time'
require 'base64'
+require 'bigdecimal'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/string/inflections'
+require 'active_support/core_ext/date_time/calculations'
module ActiveSupport
# = XmlMini
@@ -56,13 +58,13 @@ module ActiveSupport
# TODO use regexp instead of Date.parse
unless defined?(PARSING)
PARSING = {
- "symbol" => Proc.new { |symbol| symbol.to_sym },
+ "symbol" => Proc.new { |symbol| symbol.to_s.to_sym },
"date" => Proc.new { |date| ::Date.parse(date) },
"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) },
- "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) },
+ "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },
"string" => Proc.new { |string| string.to_s },
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
"base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },