activesupport 3.0.20 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +24 -28
- data/README.rdoc +2 -2
- data/lib/active_support/backtrace_cleaner.rb +17 -12
- data/lib/active_support/buffered_logger.rb +7 -9
- data/lib/active_support/cache/file_store.rb +4 -3
- data/lib/active_support/cache/mem_cache_store.rb +10 -2
- data/lib/active_support/cache/strategy/local_cache.rb +28 -23
- data/lib/active_support/cache.rb +11 -14
- data/lib/active_support/callbacks.rb +195 -175
- data/lib/active_support/concern.rb +105 -35
- data/lib/active_support/configurable.rb +50 -8
- data/lib/active_support/core_ext/array/access.rb +2 -2
- data/lib/active_support/core_ext/array/conversions.rb +2 -2
- data/lib/active_support/core_ext/array/random_access.rb +10 -7
- data/lib/active_support/core_ext/array/uniq_by.rb +2 -3
- data/lib/active_support/core_ext/array/wrap.rb +1 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -2
- data/lib/active_support/core_ext/class/attribute.rb +15 -1
- data/lib/active_support/core_ext/class/inheritable_attributes.rb +10 -86
- data/lib/active_support/core_ext/class/subclasses.rb +20 -34
- data/lib/active_support/core_ext/date/calculations.rb +17 -5
- data/lib/active_support/core_ext/date/conversions.rb +9 -2
- data/lib/active_support/core_ext/date_time/calculations.rb +26 -9
- data/lib/active_support/core_ext/date_time/conversions.rb +9 -9
- data/lib/active_support/core_ext/date_time/zones.rb +1 -1
- data/lib/active_support/core_ext/enumerable.rb +3 -6
- data/lib/active_support/core_ext/float/rounding.rb +1 -1
- data/lib/active_support/core_ext/hash/conversions.rb +22 -34
- data/lib/active_support/core_ext/hash/deep_dup.rb +11 -0
- data/lib/active_support/core_ext/hash/indifferent_access.rb +12 -0
- data/lib/active_support/core_ext/hash/keys.rb +6 -4
- data/lib/active_support/core_ext/hash/reverse_merge.rb +9 -14
- data/lib/active_support/core_ext/hash/slice.rb +3 -1
- data/lib/active_support/core_ext/hash.rb +1 -0
- data/lib/active_support/core_ext/integer/inflections.rb +7 -4
- data/lib/active_support/core_ext/kernel/reporting.rb +31 -0
- data/lib/active_support/core_ext/kernel/requires.rb +2 -0
- data/lib/active_support/core_ext/logger.rb +11 -38
- data/lib/active_support/core_ext/module/attr_accessor_with_default.rb +12 -12
- data/lib/active_support/core_ext/module/attr_internal.rb +13 -6
- data/lib/active_support/core_ext/module/delegation.rb +1 -5
- data/lib/active_support/core_ext/module/remove_method.rb +7 -2
- data/lib/active_support/core_ext/numeric/time.rb +2 -0
- data/lib/active_support/core_ext/object/blank.rb +45 -12
- data/lib/active_support/core_ext/object/duplicable.rb +50 -9
- data/lib/active_support/core_ext/object/inclusion.rb +15 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +1 -35
- data/lib/active_support/core_ext/object/to_param.rb +13 -8
- data/lib/active_support/core_ext/object/to_query.rb +2 -2
- data/lib/active_support/core_ext/object/try.rb +29 -10
- data/lib/active_support/core_ext/object/with_options.rb +25 -8
- data/lib/active_support/core_ext/object.rb +1 -1
- data/lib/active_support/core_ext/range/cover.rb +3 -0
- data/lib/active_support/core_ext/range.rb +1 -0
- data/lib/active_support/core_ext/string/behavior.rb +1 -2
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- data/lib/active_support/core_ext/string/exclude.rb +1 -1
- data/lib/active_support/core_ext/string/filters.rb +3 -3
- data/lib/active_support/core_ext/string/inflections.rb +1 -1
- data/lib/active_support/core_ext/string/inquiry.rb +13 -0
- data/lib/active_support/core_ext/string/multibyte.rb +2 -2
- data/lib/active_support/core_ext/string/output_safety.rb +45 -62
- data/lib/active_support/core_ext/string.rb +1 -0
- data/lib/active_support/core_ext/time/calculations.rb +19 -16
- data/lib/active_support/core_ext/time/conversions.rb +2 -24
- data/lib/active_support/core_ext/time/zones.rb +32 -21
- data/lib/active_support/core_ext/uri.rb +8 -0
- data/lib/active_support/dependencies.rb +74 -28
- data/lib/active_support/deprecation/behaviors.rb +7 -0
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/deprecation/reporting.rb +4 -0
- data/lib/active_support/deprecation.rb +2 -2
- data/lib/active_support/descendants_tracker.rb +9 -7
- data/lib/active_support/duration.rb +5 -0
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/file_watcher.rb +36 -0
- data/lib/active_support/hash_with_indifferent_access.rb +20 -8
- data/lib/active_support/i18n.rb +0 -1
- data/lib/active_support/i18n_railtie.rb +2 -2
- data/lib/active_support/inflections.rb +1 -0
- data/lib/active_support/inflector/inflections.rb +1 -1
- data/lib/active_support/inflector/methods.rb +5 -3
- data/lib/active_support/json/decoding.rb +37 -23
- data/lib/active_support/json/encoding.rb +12 -4
- data/lib/active_support/lazy_load_hooks.rb +7 -7
- data/lib/active_support/log_subscriber/test_helper.rb +5 -3
- data/lib/active_support/log_subscriber.rb +6 -6
- data/lib/active_support/message_encryptor.rb +1 -1
- data/lib/active_support/message_verifier.rb +1 -1
- data/lib/active_support/multibyte/chars.rb +5 -5
- data/lib/active_support/multibyte/unicode.rb +2 -1
- data/lib/active_support/notifications/fanout.rb +3 -3
- data/lib/active_support/notifications/instrumenter.rb +1 -1
- data/lib/active_support/notifications.rb +9 -10
- data/lib/active_support/ordered_hash.rb +23 -2
- data/lib/active_support/ordered_options.rb +37 -3
- data/lib/active_support/railtie.rb +1 -1
- data/lib/active_support/rescuable.rb +1 -0
- data/lib/active_support/secure_random.rb +3 -196
- data/lib/active_support/test_case.rb +2 -10
- data/lib/active_support/testing/assertions.rb +20 -7
- data/lib/active_support/testing/mochaing.rb +7 -0
- data/lib/active_support/testing/pending.rb +27 -23
- data/lib/active_support/testing/performance/jruby.rb +115 -0
- data/lib/active_support/testing/performance/rubinius.rb +113 -0
- data/lib/active_support/testing/performance/ruby/mri.rb +57 -0
- data/lib/active_support/testing/performance/ruby/yarv.rb +57 -0
- data/lib/active_support/testing/performance/ruby.rb +152 -0
- data/lib/active_support/testing/performance.rb +214 -322
- data/lib/active_support/testing/setup_and_teardown.rb +8 -11
- data/lib/active_support/time_with_zone.rb +6 -3
- data/lib/active_support/values/time_zone.rb +26 -8
- data/lib/active_support/version.rb +2 -2
- data/lib/active_support/whiny_nil.rb +1 -1
- data/lib/active_support/xml_mini/jdom.rb +1 -1
- data/lib/active_support/xml_mini/libxml.rb +1 -0
- data/lib/active_support/xml_mini/libxmlsax.rb +2 -1
- data/lib/active_support/xml_mini/nokogiri.rb +1 -0
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -0
- data/lib/active_support/xml_mini/rexml.rb +1 -0
- data/lib/active_support/xml_mini.rb +8 -3
- data/lib/active_support.rb +4 -2
- metadata +70 -32
- checksums.yaml +0 -7
- data/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -19
- data/lib/active_support/core_ext/cgi.rb +0 -1
- data/lib/active_support/core_ext/object/returning.rb +0 -43
- data/lib/active_support/json/backends/jsongem.rb +0 -47
- data/lib/active_support/json/backends/okjson.rb +0 -644
- data/lib/active_support/json/backends/yajl.rb +0 -44
- data/lib/active_support/json/backends/yaml.rb +0 -19
- data/lib/active_support/testing/default.rb +0 -9
|
@@ -31,14 +31,14 @@ module ActiveSupport
|
|
|
31
31
|
def run(runner)
|
|
32
32
|
result = '.'
|
|
33
33
|
begin
|
|
34
|
-
|
|
34
|
+
run_callbacks :setup do
|
|
35
35
|
result = super
|
|
36
36
|
end
|
|
37
37
|
rescue Exception => e
|
|
38
38
|
result = runner.puke(self.class, method_name, e)
|
|
39
39
|
ensure
|
|
40
40
|
begin
|
|
41
|
-
|
|
41
|
+
run_callbacks :teardown
|
|
42
42
|
rescue Exception => e
|
|
43
43
|
result = runner.puke(self.class, method_name, e)
|
|
44
44
|
end
|
|
@@ -56,13 +56,13 @@ module ActiveSupport
|
|
|
56
56
|
def run(result)
|
|
57
57
|
return if @method_name.to_s == "default_test"
|
|
58
58
|
|
|
59
|
-
mocha_counter = retrieve_mocha_counter(
|
|
59
|
+
mocha_counter = retrieve_mocha_counter(result)
|
|
60
60
|
yield(Test::Unit::TestCase::STARTED, name)
|
|
61
61
|
@_result = result
|
|
62
62
|
|
|
63
63
|
begin
|
|
64
64
|
begin
|
|
65
|
-
|
|
65
|
+
run_callbacks :setup do
|
|
66
66
|
setup
|
|
67
67
|
__send__(@method_name)
|
|
68
68
|
mocha_verify(mocha_counter) if mocha_counter
|
|
@@ -77,9 +77,7 @@ module ActiveSupport
|
|
|
77
77
|
ensure
|
|
78
78
|
begin
|
|
79
79
|
teardown
|
|
80
|
-
|
|
81
|
-
rescue Mocha::ExpectationError => e
|
|
82
|
-
add_failure(e.message, e.backtrace)
|
|
80
|
+
run_callbacks :teardown
|
|
83
81
|
rescue Test::Unit::AssertionFailedError => e
|
|
84
82
|
add_failure(e.message, e.backtrace)
|
|
85
83
|
rescue Exception => e
|
|
@@ -97,18 +95,17 @@ module ActiveSupport
|
|
|
97
95
|
|
|
98
96
|
protected
|
|
99
97
|
|
|
100
|
-
def retrieve_mocha_counter(
|
|
98
|
+
def retrieve_mocha_counter(result) #:nodoc:
|
|
101
99
|
if respond_to?(:mocha_verify) # using mocha
|
|
102
100
|
if defined?(Mocha::TestCaseAdapter::AssertionCounter)
|
|
103
101
|
Mocha::TestCaseAdapter::AssertionCounter.new(result)
|
|
104
|
-
elsif defined?(Mocha::Integration::TestUnit::AssertionCounter)
|
|
105
|
-
Mocha::Integration::TestUnit::AssertionCounter.new(result)
|
|
106
102
|
else
|
|
107
|
-
Mocha::Integration::AssertionCounter.new(
|
|
103
|
+
Mocha::Integration::TestUnit::AssertionCounter.new(result)
|
|
108
104
|
end
|
|
109
105
|
end
|
|
110
106
|
end
|
|
111
107
|
end
|
|
108
|
+
|
|
112
109
|
end
|
|
113
110
|
end
|
|
114
111
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "active_support/values/time_zone"
|
|
2
2
|
require 'active_support/core_ext/object/acts_like'
|
|
3
|
+
require 'active_support/core_ext/object/inclusion'
|
|
3
4
|
|
|
4
5
|
module ActiveSupport
|
|
5
6
|
# A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are
|
|
@@ -32,6 +33,7 @@ module ActiveSupport
|
|
|
32
33
|
# t > Time.utc(1999) # => true
|
|
33
34
|
# t.is_a?(Time) # => true
|
|
34
35
|
# t.is_a?(ActiveSupport::TimeWithZone) # => true
|
|
36
|
+
#
|
|
35
37
|
class TimeWithZone
|
|
36
38
|
def self.name
|
|
37
39
|
'Time' # Report class name as 'Time' to thwart type checking
|
|
@@ -127,6 +129,7 @@ module ActiveSupport
|
|
|
127
129
|
# # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
|
|
128
130
|
# Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
|
|
129
131
|
# # => "2005/02/01 15:15:10 +0000"
|
|
132
|
+
#
|
|
130
133
|
def as_json(options = nil)
|
|
131
134
|
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
|
|
132
135
|
xmlschema
|
|
@@ -279,7 +282,7 @@ module ActiveSupport
|
|
|
279
282
|
|
|
280
283
|
# A TimeWithZone acts like a Time, so just return +self+.
|
|
281
284
|
def to_time
|
|
282
|
-
|
|
285
|
+
utc
|
|
283
286
|
end
|
|
284
287
|
|
|
285
288
|
def to_datetime
|
|
@@ -307,7 +310,7 @@ module ActiveSupport
|
|
|
307
310
|
end
|
|
308
311
|
|
|
309
312
|
def marshal_load(variables)
|
|
310
|
-
initialize(variables[0].utc, ::Time.
|
|
313
|
+
initialize(variables[0].utc, ::Time.find_zone(variables[1]), variables[2].utc)
|
|
311
314
|
end
|
|
312
315
|
|
|
313
316
|
# Ensure proxy class responds to all methods that underlying time instance responds to.
|
|
@@ -342,7 +345,7 @@ module ActiveSupport
|
|
|
342
345
|
end
|
|
343
346
|
|
|
344
347
|
def duration_of_variable_length?(obj)
|
|
345
|
-
ActiveSupport::Duration === obj && obj.parts.any? {|p| [:years, :months, :days]
|
|
348
|
+
ActiveSupport::Duration === obj && obj.parts.any? {|p| p[0].in?([:years, :months, :days]) }
|
|
346
349
|
end
|
|
347
350
|
end
|
|
348
351
|
end
|
|
@@ -195,12 +195,8 @@ module ActiveSupport
|
|
|
195
195
|
# (GMT). Seconds were chosen as the offset unit because that is the unit that
|
|
196
196
|
# Ruby uses to represent time zone offsets (see Time#utc_offset).
|
|
197
197
|
def initialize(name, utc_offset = nil, tzinfo = nil)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
rescue LoadError => e
|
|
201
|
-
$stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"
|
|
202
|
-
raise e
|
|
203
|
-
end
|
|
198
|
+
self.class.send(:require_tzinfo)
|
|
199
|
+
|
|
204
200
|
@name = name
|
|
205
201
|
@utc_offset = utc_offset
|
|
206
202
|
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
|
|
@@ -339,7 +335,12 @@ module ActiveSupport
|
|
|
339
335
|
end
|
|
340
336
|
|
|
341
337
|
def zones_map
|
|
342
|
-
@zones_map ||=
|
|
338
|
+
@zones_map ||= begin
|
|
339
|
+
new_zones_names = MAPPING.keys - lazy_zones_map.keys
|
|
340
|
+
new_zones = Hash[new_zones_names.map { |place| [place, create(place)] }]
|
|
341
|
+
|
|
342
|
+
lazy_zones_map.merge(new_zones)
|
|
343
|
+
end
|
|
343
344
|
end
|
|
344
345
|
|
|
345
346
|
# Locate a specific time zone object. If the argument is a string, it
|
|
@@ -351,7 +352,7 @@ module ActiveSupport
|
|
|
351
352
|
case arg
|
|
352
353
|
when String
|
|
353
354
|
begin
|
|
354
|
-
|
|
355
|
+
lazy_zones_map[arg] ||= lookup(arg).tap { |tz| tz.utc_offset }
|
|
355
356
|
rescue TZInfo::InvalidTimezoneIdentifier
|
|
356
357
|
nil
|
|
357
358
|
end
|
|
@@ -369,11 +370,28 @@ module ActiveSupport
|
|
|
369
370
|
@us_zones ||= all.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
|
|
370
371
|
end
|
|
371
372
|
|
|
373
|
+
protected
|
|
374
|
+
|
|
375
|
+
def require_tzinfo
|
|
376
|
+
require 'tzinfo'
|
|
377
|
+
rescue LoadError
|
|
378
|
+
$stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install"
|
|
379
|
+
raise
|
|
380
|
+
end
|
|
381
|
+
|
|
372
382
|
private
|
|
373
383
|
|
|
374
384
|
def lookup(name)
|
|
375
385
|
(tzinfo = find_tzinfo(name)) && create(tzinfo.name.freeze)
|
|
376
386
|
end
|
|
387
|
+
|
|
388
|
+
def lazy_zones_map
|
|
389
|
+
require_tzinfo
|
|
390
|
+
|
|
391
|
+
@lazy_zones_map ||= Hash.new do |hash, place|
|
|
392
|
+
hash[place] = create(place) if MAPPING.has_key?(place)
|
|
393
|
+
end
|
|
394
|
+
end
|
|
377
395
|
end
|
|
378
396
|
end
|
|
379
397
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'active_support/core_ext/module/delegation'
|
|
2
|
+
require 'active_support/core_ext/string/inflections'
|
|
2
3
|
|
|
3
4
|
module ActiveSupport
|
|
4
5
|
# = XmlMini
|
|
@@ -126,9 +127,11 @@ module ActiveSupport
|
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
def rename_key(key, options = {})
|
|
129
|
-
camelize = options
|
|
130
|
+
camelize = options[:camelize]
|
|
130
131
|
dasherize = !options.has_key?(:dasherize) || options[:dasherize]
|
|
131
|
-
|
|
132
|
+
if camelize
|
|
133
|
+
key = true == camelize ? key.camelize : key.camelize(camelize)
|
|
134
|
+
end
|
|
132
135
|
key = _dasherize(key) if dasherize
|
|
133
136
|
key
|
|
134
137
|
end
|
|
@@ -136,7 +139,9 @@ module ActiveSupport
|
|
|
136
139
|
protected
|
|
137
140
|
|
|
138
141
|
def _dasherize(key)
|
|
139
|
-
|
|
142
|
+
# $2 must be a non-greedy regex for this to work
|
|
143
|
+
left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1,3]
|
|
144
|
+
"#{left}#{middle.tr('_ ', '--')}#{right}"
|
|
140
145
|
end
|
|
141
146
|
|
|
142
147
|
# TODO: Add support for other encodings
|
data/lib/active_support.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright (c) 2005 David Heinemeier Hansson
|
|
2
|
+
# Copyright (c) 2005-2011 David Heinemeier Hansson
|
|
3
3
|
#
|
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
5
|
# a copy of this software and associated documentation files (the
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
#++
|
|
23
23
|
|
|
24
|
+
require 'securerandom'
|
|
25
|
+
|
|
24
26
|
module ActiveSupport
|
|
25
27
|
class << self
|
|
26
28
|
attr_accessor :load_all_hooks
|
|
@@ -30,7 +32,7 @@ module ActiveSupport
|
|
|
30
32
|
self.load_all_hooks = []
|
|
31
33
|
|
|
32
34
|
on_load_all do
|
|
33
|
-
[Dependencies, Deprecation, Gzip, MessageVerifier, Multibyte
|
|
35
|
+
[Dependencies, Deprecation, Gzip, MessageVerifier, Multibyte]
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
|
metadata
CHANGED
|
@@ -1,23 +1,46 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activesupport
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 3
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 3
|
|
8
|
+
- 1
|
|
9
|
+
- 0
|
|
10
|
+
version: 3.1.0
|
|
5
11
|
platform: ruby
|
|
6
|
-
authors:
|
|
12
|
+
authors:
|
|
7
13
|
- David Heinemeier Hansson
|
|
8
14
|
autorequire:
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
date: 2011-08-31 00:00:00 Z
|
|
19
|
+
dependencies:
|
|
20
|
+
- !ruby/object:Gem::Dependency
|
|
21
|
+
name: multi_json
|
|
22
|
+
prerelease: false
|
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
24
|
+
none: false
|
|
25
|
+
requirements:
|
|
26
|
+
- - ~>
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
hash: 15
|
|
29
|
+
segments:
|
|
30
|
+
- 1
|
|
31
|
+
- 0
|
|
32
|
+
version: "1.0"
|
|
33
|
+
type: :runtime
|
|
34
|
+
version_requirements: *id001
|
|
35
|
+
description: A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Rich support for multibyte strings, internationalization, time zones, and testing.
|
|
16
36
|
email: david@loudthinking.com
|
|
17
37
|
executables: []
|
|
38
|
+
|
|
18
39
|
extensions: []
|
|
40
|
+
|
|
19
41
|
extra_rdoc_files: []
|
|
20
|
-
|
|
42
|
+
|
|
43
|
+
files:
|
|
21
44
|
- CHANGELOG
|
|
22
45
|
- README.rdoc
|
|
23
46
|
- lib/active_support/all.rb
|
|
@@ -48,8 +71,6 @@ files:
|
|
|
48
71
|
- lib/active_support/core_ext/benchmark.rb
|
|
49
72
|
- lib/active_support/core_ext/big_decimal/conversions.rb
|
|
50
73
|
- lib/active_support/core_ext/big_decimal.rb
|
|
51
|
-
- lib/active_support/core_ext/cgi/escape_skipping_slashes.rb
|
|
52
|
-
- lib/active_support/core_ext/cgi.rb
|
|
53
74
|
- lib/active_support/core_ext/class/attribute.rb
|
|
54
75
|
- lib/active_support/core_ext/class/attribute_accessors.rb
|
|
55
76
|
- lib/active_support/core_ext/class/delegating_attributes.rb
|
|
@@ -73,6 +94,7 @@ files:
|
|
|
73
94
|
- lib/active_support/core_ext/float/rounding.rb
|
|
74
95
|
- lib/active_support/core_ext/float.rb
|
|
75
96
|
- lib/active_support/core_ext/hash/conversions.rb
|
|
97
|
+
- lib/active_support/core_ext/hash/deep_dup.rb
|
|
76
98
|
- lib/active_support/core_ext/hash/deep_merge.rb
|
|
77
99
|
- lib/active_support/core_ext/hash/diff.rb
|
|
78
100
|
- lib/active_support/core_ext/hash/except.rb
|
|
@@ -114,8 +136,8 @@ files:
|
|
|
114
136
|
- lib/active_support/core_ext/object/blank.rb
|
|
115
137
|
- lib/active_support/core_ext/object/conversions.rb
|
|
116
138
|
- lib/active_support/core_ext/object/duplicable.rb
|
|
139
|
+
- lib/active_support/core_ext/object/inclusion.rb
|
|
117
140
|
- lib/active_support/core_ext/object/instance_variables.rb
|
|
118
|
-
- lib/active_support/core_ext/object/returning.rb
|
|
119
141
|
- lib/active_support/core_ext/object/to_json.rb
|
|
120
142
|
- lib/active_support/core_ext/object/to_param.rb
|
|
121
143
|
- lib/active_support/core_ext/object/to_query.rb
|
|
@@ -127,6 +149,7 @@ files:
|
|
|
127
149
|
- lib/active_support/core_ext/process.rb
|
|
128
150
|
- lib/active_support/core_ext/range/blockless_step.rb
|
|
129
151
|
- lib/active_support/core_ext/range/conversions.rb
|
|
152
|
+
- lib/active_support/core_ext/range/cover.rb
|
|
130
153
|
- lib/active_support/core_ext/range/include_range.rb
|
|
131
154
|
- lib/active_support/core_ext/range/overlaps.rb
|
|
132
155
|
- lib/active_support/core_ext/range.rb
|
|
@@ -139,6 +162,7 @@ files:
|
|
|
139
162
|
- lib/active_support/core_ext/string/exclude.rb
|
|
140
163
|
- lib/active_support/core_ext/string/filters.rb
|
|
141
164
|
- lib/active_support/core_ext/string/inflections.rb
|
|
165
|
+
- lib/active_support/core_ext/string/inquiry.rb
|
|
142
166
|
- lib/active_support/core_ext/string/interpolation.rb
|
|
143
167
|
- lib/active_support/core_ext/string/multibyte.rb
|
|
144
168
|
- lib/active_support/core_ext/string/output_safety.rb
|
|
@@ -164,6 +188,7 @@ files:
|
|
|
164
188
|
- lib/active_support/descendants_tracker.rb
|
|
165
189
|
- lib/active_support/duration.rb
|
|
166
190
|
- lib/active_support/file_update_checker.rb
|
|
191
|
+
- lib/active_support/file_watcher.rb
|
|
167
192
|
- lib/active_support/gzip.rb
|
|
168
193
|
- lib/active_support/hash_with_indifferent_access.rb
|
|
169
194
|
- lib/active_support/i18n.rb
|
|
@@ -173,10 +198,6 @@ files:
|
|
|
173
198
|
- lib/active_support/inflector/methods.rb
|
|
174
199
|
- lib/active_support/inflector/transliterate.rb
|
|
175
200
|
- lib/active_support/inflector.rb
|
|
176
|
-
- lib/active_support/json/backends/jsongem.rb
|
|
177
|
-
- lib/active_support/json/backends/okjson.rb
|
|
178
|
-
- lib/active_support/json/backends/yajl.rb
|
|
179
|
-
- lib/active_support/json/backends/yaml.rb
|
|
180
201
|
- lib/active_support/json/decoding.rb
|
|
181
202
|
- lib/active_support/json/encoding.rb
|
|
182
203
|
- lib/active_support/json/variable.rb
|
|
@@ -207,10 +228,15 @@ files:
|
|
|
207
228
|
- lib/active_support/test_case.rb
|
|
208
229
|
- lib/active_support/testing/assertions.rb
|
|
209
230
|
- lib/active_support/testing/declarative.rb
|
|
210
|
-
- lib/active_support/testing/default.rb
|
|
211
231
|
- lib/active_support/testing/deprecation.rb
|
|
212
232
|
- lib/active_support/testing/isolation.rb
|
|
233
|
+
- lib/active_support/testing/mochaing.rb
|
|
213
234
|
- lib/active_support/testing/pending.rb
|
|
235
|
+
- lib/active_support/testing/performance/jruby.rb
|
|
236
|
+
- lib/active_support/testing/performance/rubinius.rb
|
|
237
|
+
- lib/active_support/testing/performance/ruby/mri.rb
|
|
238
|
+
- lib/active_support/testing/performance/ruby/yarv.rb
|
|
239
|
+
- lib/active_support/testing/performance/ruby.rb
|
|
214
240
|
- lib/active_support/testing/performance.rb
|
|
215
241
|
- lib/active_support/testing/setup_and_teardown.rb
|
|
216
242
|
- lib/active_support/time/autoload.rb
|
|
@@ -230,26 +256,38 @@ files:
|
|
|
230
256
|
- lib/active_support.rb
|
|
231
257
|
homepage: http://www.rubyonrails.org
|
|
232
258
|
licenses: []
|
|
233
|
-
|
|
259
|
+
|
|
234
260
|
post_install_message:
|
|
235
261
|
rdoc_options: []
|
|
236
|
-
|
|
262
|
+
|
|
263
|
+
require_paths:
|
|
237
264
|
- lib
|
|
238
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
|
-
|
|
265
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
|
+
none: false
|
|
267
|
+
requirements:
|
|
240
268
|
- - ">="
|
|
241
|
-
- !ruby/object:Gem::Version
|
|
269
|
+
- !ruby/object:Gem::Version
|
|
270
|
+
hash: 57
|
|
271
|
+
segments:
|
|
272
|
+
- 1
|
|
273
|
+
- 8
|
|
274
|
+
- 7
|
|
242
275
|
version: 1.8.7
|
|
243
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
|
-
|
|
276
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
|
+
none: false
|
|
278
|
+
requirements:
|
|
245
279
|
- - ">="
|
|
246
|
-
- !ruby/object:Gem::Version
|
|
247
|
-
|
|
280
|
+
- !ruby/object:Gem::Version
|
|
281
|
+
hash: 3
|
|
282
|
+
segments:
|
|
283
|
+
- 0
|
|
284
|
+
version: "0"
|
|
248
285
|
requirements: []
|
|
249
|
-
|
|
250
|
-
|
|
286
|
+
|
|
287
|
+
rubyforge_project:
|
|
288
|
+
rubygems_version: 1.8.8
|
|
251
289
|
signing_key:
|
|
252
|
-
specification_version:
|
|
253
|
-
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
|
254
|
-
Rails framework.
|
|
290
|
+
specification_version: 3
|
|
291
|
+
summary: A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
|
|
255
292
|
test_files: []
|
|
293
|
+
|
checksums.yaml
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
SHA1:
|
|
3
|
-
metadata.gz: 5b10c504f7e89e31840146dc035f18db58ec6781
|
|
4
|
-
data.tar.gz: 174429c89cdc72aca932d18d7d89c64abc1f5ee8
|
|
5
|
-
SHA512:
|
|
6
|
-
metadata.gz: 6a1c10cce67fafe77efc20d56aa8039c873d457a63958b6c27a946dbe7414b6e7d745f2f4813a70d5b720454b5fb7ffc40658337a501a18a352813a7604fec38
|
|
7
|
-
data.tar.gz: a3b25fac82589dfb772fc9efd3ac4b8f4ec906c25e24145c1cf261208761d1b30e38e8763d66583be1ec4e6398e9aabce4e0d609a1fe995515f715488a5b7095
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'cgi'
|
|
2
|
-
|
|
3
|
-
class CGI #:nodoc:
|
|
4
|
-
if RUBY_VERSION >= '1.9'
|
|
5
|
-
def self.escape_skipping_slashes(str)
|
|
6
|
-
str = str.join('/') if str.respond_to? :join
|
|
7
|
-
str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do
|
|
8
|
-
"%#{$1.unpack('H2' * $1.bytesize).join('%').upcase}"
|
|
9
|
-
end.tr(' ', '+')
|
|
10
|
-
end
|
|
11
|
-
else
|
|
12
|
-
def self.escape_skipping_slashes(str)
|
|
13
|
-
str = str.join('/') if str.respond_to? :join
|
|
14
|
-
str.gsub(/([^ \/a-zA-Z0-9_.-])/n) do
|
|
15
|
-
"%#{$1.unpack('H2').first.upcase}"
|
|
16
|
-
end.tr(' ', '+')
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'active_support/core_ext/cgi/escape_skipping_slashes'
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
class Object
|
|
2
|
-
# Returns +value+ after yielding +value+ to the block. This simplifies the
|
|
3
|
-
# process of constructing an object, performing work on the object, and then
|
|
4
|
-
# returning the object from a method. It is a Ruby-ized realization of the K
|
|
5
|
-
# combinator, courtesy of Mikael Brockman.
|
|
6
|
-
#
|
|
7
|
-
# ==== Examples
|
|
8
|
-
#
|
|
9
|
-
# # Without returning
|
|
10
|
-
# def foo
|
|
11
|
-
# values = []
|
|
12
|
-
# values << "bar"
|
|
13
|
-
# values << "baz"
|
|
14
|
-
# return values
|
|
15
|
-
# end
|
|
16
|
-
#
|
|
17
|
-
# foo # => ['bar', 'baz']
|
|
18
|
-
#
|
|
19
|
-
# # returning with a local variable
|
|
20
|
-
# def foo
|
|
21
|
-
# returning values = [] do
|
|
22
|
-
# values << 'bar'
|
|
23
|
-
# values << 'baz'
|
|
24
|
-
# end
|
|
25
|
-
# end
|
|
26
|
-
#
|
|
27
|
-
# foo # => ['bar', 'baz']
|
|
28
|
-
#
|
|
29
|
-
# # returning with a block argument
|
|
30
|
-
# def foo
|
|
31
|
-
# returning [] do |values|
|
|
32
|
-
# values << 'bar'
|
|
33
|
-
# values << 'baz'
|
|
34
|
-
# end
|
|
35
|
-
# end
|
|
36
|
-
#
|
|
37
|
-
# foo # => ['bar', 'baz']
|
|
38
|
-
def returning(value)
|
|
39
|
-
ActiveSupport::Deprecation.warn('Object#returning has been deprecated in favor of Object#tap.', caller)
|
|
40
|
-
yield(value)
|
|
41
|
-
value
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require 'json' unless defined?(JSON)
|
|
2
|
-
|
|
3
|
-
module ActiveSupport
|
|
4
|
-
module JSON
|
|
5
|
-
module Backends
|
|
6
|
-
module JSONGem
|
|
7
|
-
ParseError = ::JSON::ParserError
|
|
8
|
-
extend self
|
|
9
|
-
|
|
10
|
-
# Parses a JSON string or IO and convert it into an object
|
|
11
|
-
def decode(json)
|
|
12
|
-
if json.respond_to?(:read)
|
|
13
|
-
json = json.read
|
|
14
|
-
end
|
|
15
|
-
data = ::JSON.parse(json)
|
|
16
|
-
if ActiveSupport.parse_json_times
|
|
17
|
-
convert_dates_from(data)
|
|
18
|
-
else
|
|
19
|
-
data
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
def convert_dates_from(data)
|
|
25
|
-
case data
|
|
26
|
-
when nil
|
|
27
|
-
nil
|
|
28
|
-
when DATE_REGEX
|
|
29
|
-
begin
|
|
30
|
-
DateTime.parse(data)
|
|
31
|
-
rescue ArgumentError
|
|
32
|
-
data
|
|
33
|
-
end
|
|
34
|
-
when Array
|
|
35
|
-
data.map! { |d| convert_dates_from(d) }
|
|
36
|
-
when Hash
|
|
37
|
-
data.each do |key, value|
|
|
38
|
-
data[key] = convert_dates_from(value)
|
|
39
|
-
end
|
|
40
|
-
else
|
|
41
|
-
data
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|