activesupport 4.1.0.rc1 → 4.1.0.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87a46d55993c7fe10cc8ba6a01d4474d7066ae02
4
- data.tar.gz: 9b0148f8a1f14cae020e29bc96c5ef94892ec170
3
+ metadata.gz: 9c412453341baa786256a049851c56e33619de72
4
+ data.tar.gz: 83b6a9ff233f90f816c9eca0d364e4785352007a
5
5
  SHA512:
6
- metadata.gz: 0f5d24838b7c3b27cddda961dc881e0a319e39970c74ba353ac0e5bdc1fa080509452fe6a6ad2c5bf018fca83da3861da98755fcee65a7115b9914ff9ba3ab9d
7
- data.tar.gz: 45372e3716334f5afd51512fe9b566e1b150a8864d836c3dea23ce245709d6ddd97870ab0cd00c483230a3e34a67f1e81b7f13a79af4f4e43ec32c80b1f5d788
6
+ metadata.gz: 16eafe627f87559b5c9b991e6f94f34344f6a6c4d96205904be60768c8199be19869b56a7e49d1315f0ffb00e30ae62b1c89d0a3a1373571339b7ce0515a6b02
7
+ data.tar.gz: 11928cbfbb763e53a342bd7cccb13f080221b2487310ca0a154940896b7430a420c1e1efa7b5b98bc0c9fff71f19d6eb5cbc1afa84e5387277fcad5c3f6c34d5
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- * Added `Object#present_in` to simplify value whitelisting.
1
+ * Added `Object#presence_in` to simplify value whitelisting.
2
2
 
3
3
  Before:
4
4
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  After:
8
8
 
9
- params[:bucket_type].present_in %w( project calendar )
9
+ params[:bucket_type].presence_in %w( project calendar )
10
10
 
11
11
  *DHH*
12
12
 
@@ -38,8 +38,10 @@
38
38
  * Deprecate custom `BigDecimal` serialization.
39
39
 
40
40
  Deprecate the custom `BigDecimal` serialization that is included when requiring
41
- `active_support/all` as a fix for #12467. Let Ruby handle YAML serialization
42
- for `BigDecimal` instead.
41
+ `active_support/all`. Let Ruby handle YAML serialization for `BigDecimal`
42
+ instead.
43
+
44
+ Fixes #12467.
43
45
 
44
46
  *David Celis*
45
47
 
@@ -234,13 +236,6 @@
234
236
 
235
237
  *Gonzalo Rodríguez-Baltanás Díaz*
236
238
 
237
- * Both `cattr_*` and `mattr_*` method definitions now live in `active_support/core_ext/module/attribute_accessors`.
238
-
239
- Requires to `active_support/core_ext/class/attribute_accessors` are
240
- deprecated and will be removed in Ruby on Rails 4.2.
241
-
242
- *Genadi Samokovarov*
243
-
244
239
  * Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to explicitly
245
240
  convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
246
241
 
data/README.rdoc CHANGED
@@ -14,7 +14,7 @@ The latest version of Active Support can be installed with RubyGems:
14
14
 
15
15
  Source code can be downloaded as part of the Rails project on GitHub:
16
16
 
17
- * https://github.com/rails/rails/tree/master/activesupport
17
+ * https://github.com/rails/rails/tree/4-1-stable/activesupport
18
18
 
19
19
 
20
20
  == License
@@ -1,6 +1,5 @@
1
1
  require 'active_support/core_ext/object/duplicable'
2
2
  require 'active_support/core_ext/string/inflections'
3
- require 'rack/body_proxy'
4
3
 
5
4
  module ActiveSupport
6
5
  module Cache
@@ -9,6 +8,8 @@ module ActiveSupport
9
8
  # duration of a block. Repeated calls to the cache for the same key will hit the
10
9
  # in-memory cache for faster access.
11
10
  module LocalCache
11
+ autoload :Middleware, 'active_support/cache/strategy/local_cache_middleware'
12
+
12
13
  # Class for storing and registering the local caches.
13
14
  class LocalCacheRegistry # :nodoc:
14
15
  extend ActiveSupport::PerThreadRegistry
@@ -64,37 +65,6 @@ module ActiveSupport
64
65
  def with_local_cache
65
66
  use_temporary_local_cache(LocalStore.new) { yield }
66
67
  end
67
-
68
- #--
69
- # This class wraps up local storage for middlewares. Only the middleware method should
70
- # construct them.
71
- class Middleware # :nodoc:
72
- attr_reader :name, :local_cache_key
73
-
74
- def initialize(name, local_cache_key)
75
- @name = name
76
- @local_cache_key = local_cache_key
77
- @app = nil
78
- end
79
-
80
- def new(app)
81
- @app = app
82
- self
83
- end
84
-
85
- def call(env)
86
- LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new)
87
- response = @app.call(env)
88
- response[2] = ::Rack::BodyProxy.new(response[2]) do
89
- LocalCacheRegistry.set_cache_for(local_cache_key, nil)
90
- end
91
- response
92
- rescue Exception
93
- LocalCacheRegistry.set_cache_for(local_cache_key, nil)
94
- raise
95
- end
96
- end
97
-
98
68
  # Middleware class can be inserted as a Rack handler to be local cache for the
99
69
  # duration of request.
100
70
  def middleware
@@ -0,0 +1,39 @@
1
+ require 'rack/body_proxy'
2
+ module ActiveSupport
3
+ module Cache
4
+ module Strategy
5
+ module LocalCache
6
+
7
+ #--
8
+ # This class wraps up local storage for middlewares. Only the middleware method should
9
+ # construct them.
10
+ class Middleware # :nodoc:
11
+ attr_reader :name, :local_cache_key
12
+
13
+ def initialize(name, local_cache_key)
14
+ @name = name
15
+ @local_cache_key = local_cache_key
16
+ @app = nil
17
+ end
18
+
19
+ def new(app)
20
+ @app = app
21
+ self
22
+ end
23
+
24
+ def call(env)
25
+ LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new)
26
+ response = @app.call(env)
27
+ response[2] = ::Rack::BodyProxy.new(response[2]) do
28
+ LocalCacheRegistry.set_cache_for(local_cache_key, nil)
29
+ end
30
+ response
31
+ rescue Exception
32
+ LocalCacheRegistry.set_cache_for(local_cache_key, nil)
33
+ raise
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,6 +1,4 @@
1
- require 'active_support/deprecation'
1
+ # cattr_* became mattr_* aliases in 7dfbd91b0780fbd6a1dd9bfbc176e10894871d2d,
2
+ # but we keep this around for libraries that directly require it knowing they
3
+ # want cattr_*. No need to deprecate.
2
4
  require 'active_support/core_ext/module/attribute_accessors'
3
-
4
- ActiveSupport::Deprecation.warn(
5
- "The cattr_* method definitions have been moved into active_support/core_ext/module/attribute_accessors. Please require that instead."
6
- )
@@ -16,12 +16,12 @@ class Object
16
16
  # Returns the receiver if it's included in the argument otherwise returns +nil+.
17
17
  # Argument must be any object which responds to +#include?+. Usage:
18
18
  #
19
- # params[:bucket_type].present_in %w( project calendar )
19
+ # params[:bucket_type].presence_in %w( project calendar )
20
20
  #
21
21
  # This will throw an ArgumentError if the argument doesn't respond to +#include?+.
22
22
  #
23
23
  # @return [Object]
24
- def present_in(another_object)
24
+ def presence_in(another_object)
25
25
  self.in?(another_object) ? self : nil
26
26
  end
27
27
  end
@@ -0,0 +1,15 @@
1
+ module ActiveSupport
2
+ # Returns the version of the currently loaded ActiveSupport as a <tt>Gem::Version</tt>
3
+ def self.gem_version
4
+ Gem::Version.new VERSION::STRING
5
+ end
6
+
7
+ module VERSION
8
+ MAJOR = 4
9
+ MINOR = 1
10
+ TINY = 0
11
+ PRE = "rc2"
12
+
13
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
+ end
15
+ end
@@ -32,8 +32,7 @@ module ActiveSupport
32
32
  end
33
33
 
34
34
  formatted_string =
35
- case rounded_number
36
- when BigDecimal
35
+ if BigDecimal === rounded_number && rounded_number.finite?
37
36
  s = rounded_number.to_s('F') + '0'*precision
38
37
  a, b = s.split('.', 2)
39
38
  a + '.' + b[0, precision]
@@ -28,6 +28,10 @@ module ActiveSupport
28
28
  coder.represent_seq '!omap', map { |k,v| { k => v } }
29
29
  end
30
30
 
31
+ def select(*args, &block)
32
+ dup.tap { |hash| hash.select!(*args, &block) }
33
+ end
34
+
31
35
  def reject(*args, &block)
32
36
  dup.tap { |hash| hash.reject!(*args, &block) }
33
37
  end
@@ -1,11 +1,8 @@
1
+ require_relative 'gem_version'
2
+
1
3
  module ActiveSupport
2
- # Returns the version of the currently loaded ActiveSupport as a Gem::Version
4
+ # Returns the version of the currently loaded ActiveSupport as a <tt>Gem::Version</tt>
3
5
  def self.version
4
- Gem::Version.new "4.1.0.rc1"
5
- end
6
-
7
- module VERSION #:nodoc:
8
- MAJOR, MINOR, TINY, PRE = ActiveSupport.version.segments
9
- STRING = ActiveSupport.version.to_s
6
+ gem_version
10
7
  end
11
8
  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.0.rc1
4
+ version: 4.1.0.rc2
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-02-18 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -114,6 +114,7 @@ files:
114
114
  - lib/active_support/cache/memory_store.rb
115
115
  - lib/active_support/cache/null_store.rb
116
116
  - lib/active_support/cache/strategy/local_cache.rb
117
+ - lib/active_support/cache/strategy/local_cache_middleware.rb
117
118
  - lib/active_support/callbacks.rb
118
119
  - lib/active_support/concern.rb
119
120
  - lib/active_support/concurrency/latch.rb
@@ -243,6 +244,7 @@ files:
243
244
  - lib/active_support/duration.rb
244
245
  - lib/active_support/file_update_checker.rb
245
246
  - lib/active_support/file_watcher.rb
247
+ - lib/active_support/gem_version.rb
246
248
  - lib/active_support/gzip.rb
247
249
  - lib/active_support/hash_with_indifferent_access.rb
248
250
  - lib/active_support/i18n.rb