activesupport 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ *1.4.4* (October 12th, 2007)
2
+
3
+ * Backport: allow array and hash query parameters. Array route parameters are converted/to/a/path as before. #6765, #7047, #7462 [bgipsy, Jeremy McAnally, Dan Kubb, brendan, Diego Algorta Casamayou]
4
+
5
+
1
6
  *1.4.3* (October 4th, 2007)
2
7
 
3
8
  * Demote Hash#to_xml to use XmlSimple#xml_in_string so it can't read files or stdin. #8453 [candlerb, Jeremy Kemper]
@@ -1,5 +1,23 @@
1
1
  require 'date'
2
2
  require 'xml_simple'
3
+ require 'cgi'
4
+
5
+ # Extensions needed for Hash#to_query
6
+ class Object
7
+ def to_param #:nodoc:
8
+ to_s
9
+ end
10
+
11
+ def to_query(key) #:nodoc:
12
+ "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
13
+ end
14
+ end
15
+
16
+ class Array
17
+ def to_query(key) #:nodoc:
18
+ collect { |value| value.to_query("#{key}[]") }.sort * '&'
19
+ end
20
+ end
3
21
 
4
22
  # Locked down XmlSimple#xml_in_string
5
23
  class XmlSimple
@@ -48,6 +66,12 @@ module ActiveSupport #:nodoc:
48
66
  klass.extend(ClassMethods)
49
67
  end
50
68
 
69
+ def to_query(namespace = nil)
70
+ collect do |key, value|
71
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
72
+ end.sort * '&'
73
+ end
74
+
51
75
  def to_xml(options = {})
52
76
  options[:indent] ||= 2
53
77
  options.reverse_merge!({ :builder => Builder::XmlMarkup.new(:indent => options[:indent]),
@@ -23,12 +23,14 @@ module ActiveSupport
23
23
  "\n" => '\n',
24
24
  "\r" => '\r',
25
25
  "\t" => '\t',
26
- '"' => '\"',
27
- '\\' => '\\\\'
26
+ '"' => '\"',
27
+ '\\' => '\\\\',
28
+ '<' => '\\074',
29
+ '>' => '\\076'
28
30
  }
29
31
 
30
32
  define_encoder String do |string|
31
- '"' + string.gsub(/[\010\f\n\r\t"\\]/) { |s|
33
+ '"' + string.gsub(/[\010\f\n\r\t"\\<>]/) { |s|
32
34
  ESCAPED_CHARS[s]
33
35
  }.gsub(/([\xC0-\xDF][\x80-\xBF]|
34
36
  [\xE0-\xEF][\x80-\xBF]{2}|
@@ -2,7 +2,7 @@ module ActiveSupport
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: activesupport
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.4.3
7
- date: 2007-10-04 00:00:00 -05:00
6
+ version: 1.4.4
7
+ date: 2007-10-12 00:00:00 -05:00
8
8
  summary: Support and utility classes used by the Rails framework.
9
9
  require_paths:
10
10
  - lib