activesupport 4.1.5 → 4.1.6.rc1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +3 -1
- data/lib/active_support/core_ext/object/json.rb +3 -3
- data/lib/active_support/core_ext/object/to_param.rb +1 -60
- data/lib/active_support/core_ext/object/to_query.rb +58 -7
- data/lib/active_support/core_ext/string/output_safety.rb +1 -1
- data/lib/active_support/dependencies.rb +4 -4
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2ea00af1f197c41028724af07db2e1c8c8cff1
|
4
|
+
data.tar.gz: b6675d1850ac9d41fe34bea0041e50a101d7f269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f88f35b597ac7a66476d5e9559cd014255a5a794d131a4bed0c923e68fe7443c1c98a7aadcf1d23181aba2ffe093516c283f34ab5d1e8445b651afbe89e5f4
|
7
|
+
data.tar.gz: a8431a4c8968255985c4068cdf2b299ace86dc24f26db8405f01cfa69fef17d6b861e26ae0be734ceb829dd7bb6b2d6ac0ee622d653a99c2eed3f243c0080b0d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
## Rails 4.1.6 (August 19, 2014) ##
|
2
|
+
|
3
|
+
* Fix DateTime comparison with DateTime::Infinity object.
|
4
|
+
|
5
|
+
*Rafael Mendonça França*
|
6
|
+
|
7
|
+
* Fixed a compatibility issue with the `Oj` gem when cherry-picking the file
|
8
|
+
`active_support/core_ext/object/json` without requiring `active_support/json`.
|
9
|
+
|
10
|
+
Fixes #16131.
|
11
|
+
|
12
|
+
*Godfrey Chan*
|
13
|
+
|
14
|
+
* Make Dependencies pass a name to NameError error.
|
15
|
+
|
16
|
+
*arthurnn*, *Yuki Nishijima*
|
17
|
+
|
18
|
+
* Fixed precision error in NumberHelper when using Rationals.
|
19
|
+
|
20
|
+
before:
|
21
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
22
|
+
#=> "330.00"
|
23
|
+
after:
|
24
|
+
ActiveSupport::NumberHelper.number_to_rounded Rational(1000, 3), precision: 2
|
25
|
+
#=> "333.33"
|
26
|
+
|
27
|
+
See #15379.
|
28
|
+
|
29
|
+
*Juanjo Bazán*
|
30
|
+
|
31
|
+
|
1
32
|
## Rails 4.1.5 (August 18, 2014) ##
|
2
33
|
|
3
34
|
* No changes.
|
@@ -151,7 +151,9 @@ class DateTime
|
|
151
151
|
# Layers additional behavior on DateTime#<=> so that Time and
|
152
152
|
# ActiveSupport::TimeWithZone instances can be compared with a DateTime.
|
153
153
|
def <=>(other)
|
154
|
-
if other.
|
154
|
+
if other.kind_of?(Infinity)
|
155
|
+
super
|
156
|
+
elsif other.respond_to? :to_datetime
|
155
157
|
super other.to_datetime
|
156
158
|
else
|
157
159
|
nil
|
@@ -162,7 +162,7 @@ end
|
|
162
162
|
|
163
163
|
class Time
|
164
164
|
def as_json(options = nil) #:nodoc:
|
165
|
-
if ActiveSupport.use_standard_json_time_format
|
165
|
+
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
|
166
166
|
xmlschema(ActiveSupport::JSON::Encoding.time_precision)
|
167
167
|
else
|
168
168
|
%(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
|
@@ -172,7 +172,7 @@ end
|
|
172
172
|
|
173
173
|
class Date
|
174
174
|
def as_json(options = nil) #:nodoc:
|
175
|
-
if ActiveSupport.use_standard_json_time_format
|
175
|
+
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
|
176
176
|
strftime("%Y-%m-%d")
|
177
177
|
else
|
178
178
|
strftime("%Y/%m/%d")
|
@@ -182,7 +182,7 @@ end
|
|
182
182
|
|
183
183
|
class DateTime
|
184
184
|
def as_json(options = nil) #:nodoc:
|
185
|
-
if ActiveSupport.use_standard_json_time_format
|
185
|
+
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
|
186
186
|
xmlschema(ActiveSupport::JSON::Encoding.time_precision)
|
187
187
|
else
|
188
188
|
strftime('%Y/%m/%d %H:%M:%S %z')
|
@@ -1,60 +1 @@
|
|
1
|
-
|
2
|
-
# Alias of <tt>to_s</tt>.
|
3
|
-
def to_param
|
4
|
-
to_s
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
class NilClass
|
9
|
-
# Returns +self+.
|
10
|
-
def to_param
|
11
|
-
self
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class TrueClass
|
16
|
-
# Returns +self+.
|
17
|
-
def to_param
|
18
|
-
self
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class FalseClass
|
23
|
-
# Returns +self+.
|
24
|
-
def to_param
|
25
|
-
self
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Array
|
30
|
-
# Calls <tt>to_param</tt> on all its elements and joins the result with
|
31
|
-
# slashes. This is used by <tt>url_for</tt> in Action Pack.
|
32
|
-
def to_param
|
33
|
-
collect { |e| e.to_param }.join '/'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class Hash
|
38
|
-
# Returns a string representation of the receiver suitable for use as a URL
|
39
|
-
# query string:
|
40
|
-
#
|
41
|
-
# {name: 'David', nationality: 'Danish'}.to_param
|
42
|
-
# # => "name=David&nationality=Danish"
|
43
|
-
#
|
44
|
-
# An optional namespace can be passed to enclose the param names:
|
45
|
-
#
|
46
|
-
# {name: 'David', nationality: 'Danish'}.to_param('user')
|
47
|
-
# # => "user[name]=David&user[nationality]=Danish"
|
48
|
-
#
|
49
|
-
# The string pairs "key=value" that conform the query string
|
50
|
-
# are sorted lexicographically in ascending order.
|
51
|
-
#
|
52
|
-
# This method is also aliased as +to_query+.
|
53
|
-
def to_param(namespace = nil)
|
54
|
-
collect do |key, value|
|
55
|
-
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
|
56
|
-
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
|
57
|
-
end
|
58
|
-
end.compact.sort! * '&'
|
59
|
-
end
|
60
|
-
end
|
1
|
+
require 'active_support/core_ext/object/to_query'
|
@@ -1,17 +1,45 @@
|
|
1
|
-
require 'active_support/core_ext/object/to_param'
|
2
|
-
|
3
1
|
class Object
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
# Alias of <tt>to_s</tt>.
|
3
|
+
def to_param
|
4
|
+
to_s
|
5
|
+
end
|
6
|
+
|
7
|
+
# Converts an object into a string suitable for use as a URL query string,
|
8
|
+
# using the given <tt>key</tt> as the param name.
|
8
9
|
def to_query(key)
|
9
10
|
require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
|
10
11
|
"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
15
|
+
class NilClass
|
16
|
+
# Returns +self+.
|
17
|
+
def to_param
|
18
|
+
self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class TrueClass
|
23
|
+
# Returns +self+.
|
24
|
+
def to_param
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class FalseClass
|
30
|
+
# Returns +self+.
|
31
|
+
def to_param
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
class Array
|
37
|
+
# Calls <tt>to_param</tt> on all its elements and joins the result with
|
38
|
+
# slashes. This is used by <tt>url_for</tt> in Action Pack.
|
39
|
+
def to_param
|
40
|
+
collect { |e| e.to_param }.join '/'
|
41
|
+
end
|
42
|
+
|
15
43
|
# Converts an array into a string suitable for use as a URL query string,
|
16
44
|
# using the given +key+ as the param name.
|
17
45
|
#
|
@@ -28,5 +56,28 @@ class Array
|
|
28
56
|
end
|
29
57
|
|
30
58
|
class Hash
|
31
|
-
|
59
|
+
# Returns a string representation of the receiver suitable for use as a URL
|
60
|
+
# query string:
|
61
|
+
#
|
62
|
+
# {name: 'David', nationality: 'Danish'}.to_query
|
63
|
+
# # => "name=David&nationality=Danish"
|
64
|
+
#
|
65
|
+
# An optional namespace can be passed to enclose key names:
|
66
|
+
#
|
67
|
+
# {name: 'David', nationality: 'Danish'}.to_query('user')
|
68
|
+
# # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
|
69
|
+
#
|
70
|
+
# The string pairs "key=value" that conform the query string
|
71
|
+
# are sorted lexicographically in ascending order.
|
72
|
+
#
|
73
|
+
# This method is also aliased as +to_param+.
|
74
|
+
def to_query(namespace = nil)
|
75
|
+
collect do |key, value|
|
76
|
+
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
|
77
|
+
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
|
78
|
+
end
|
79
|
+
end.compact.sort! * '&'
|
80
|
+
end
|
81
|
+
|
82
|
+
alias_method :to_param, :to_query
|
32
83
|
end
|
@@ -6,7 +6,7 @@ class ERB
|
|
6
6
|
HTML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''' }
|
7
7
|
JSON_ESCAPE = { '&' => '\u0026', '>' => '\u003e', '<' => '\u003c', "\u2028" => '\u2028', "\u2029" => '\u2029' }
|
8
8
|
HTML_ESCAPE_REGEXP = /[&"'><]/
|
9
|
-
HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+));)/
|
9
|
+
HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+)|(#[xX][\dA-Fa-f]+));)/
|
10
10
|
JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/u
|
11
11
|
|
12
12
|
# A utility method for escaping HTML tag characters.
|
@@ -186,7 +186,7 @@ module ActiveSupport #:nodoc:
|
|
186
186
|
# and we assume therefore the user wants to refer to a top-level constant.
|
187
187
|
def guess_for_anonymous(const_name)
|
188
188
|
if Object.const_defined?(const_name)
|
189
|
-
raise NameError
|
189
|
+
raise NameError.new "#{const_name} cannot be autoloaded from an anonymous class or module", const_name
|
190
190
|
else
|
191
191
|
Object
|
192
192
|
end
|
@@ -515,9 +515,9 @@ module ActiveSupport #:nodoc:
|
|
515
515
|
end
|
516
516
|
end
|
517
517
|
|
518
|
-
|
519
|
-
|
520
|
-
|
518
|
+
name_error = NameError.new("uninitialized constant #{qualified_name}", const_name)
|
519
|
+
name_error.set_backtrace(caller.reject {|l| l.starts_with? __FILE__ })
|
520
|
+
raise name_error
|
521
521
|
end
|
522
522
|
|
523
523
|
# Remove the constants that have been autoloaded, and those that have been
|
@@ -12,11 +12,7 @@ module ActiveSupport
|
|
12
12
|
when Float, String
|
13
13
|
@number = BigDecimal(number.to_s)
|
14
14
|
when Rational
|
15
|
-
|
16
|
-
@number = BigDecimal(number, digit_count(number.to_i) + precision)
|
17
|
-
else
|
18
|
-
@number = BigDecimal(number, precision)
|
19
|
-
end
|
15
|
+
@number = BigDecimal(number, digit_count(number.to_i) + precision)
|
20
16
|
else
|
21
17
|
@number = number.to_d
|
22
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.6.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -331,9 +331,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
331
331
|
version: 1.9.3
|
332
332
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
333
333
|
requirements:
|
334
|
-
- - "
|
334
|
+
- - ">"
|
335
335
|
- !ruby/object:Gem::Version
|
336
|
-
version:
|
336
|
+
version: 1.3.1
|
337
337
|
requirements: []
|
338
338
|
rubyforge_project:
|
339
339
|
rubygems_version: 2.3.0
|