activesupport 4.0.0.beta1 → 4.0.0.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.

Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/README.rdoc +2 -2
  4. data/lib/active_support/cache.rb +62 -49
  5. data/lib/active_support/cache/file_store.rb +2 -2
  6. data/lib/active_support/cache/strategy/local_cache.rb +48 -37
  7. data/lib/active_support/callbacks.rb +27 -8
  8. data/lib/active_support/core_ext.rb +2 -2
  9. data/lib/active_support/core_ext/array/conversions.rb +5 -3
  10. data/lib/active_support/core_ext/array/uniq_by.rb +2 -2
  11. data/lib/active_support/core_ext/benchmark.rb +7 -0
  12. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -0
  13. data/lib/active_support/core_ext/class/attribute.rb +31 -27
  14. data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -2
  15. data/lib/active_support/core_ext/date_and_time/calculations.rb +6 -6
  16. data/lib/active_support/core_ext/module/delegation.rb +50 -24
  17. data/lib/active_support/core_ext/module/deprecation.rb +2 -2
  18. data/lib/active_support/core_ext/string.rb +0 -1
  19. data/lib/active_support/core_ext/string/conversions.rb +6 -8
  20. data/lib/active_support/core_ext/string/filters.rb +1 -1
  21. data/lib/active_support/core_ext/string/indent.rb +1 -1
  22. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  23. data/lib/active_support/core_ext/string/output_safety.rb +2 -2
  24. data/lib/active_support/hash_with_indifferent_access.rb +2 -2
  25. data/lib/active_support/key_generator.rb +1 -1
  26. data/lib/active_support/log_subscriber.rb +9 -46
  27. data/lib/active_support/message_encryptor.rb +9 -9
  28. data/lib/active_support/message_verifier.rb +3 -3
  29. data/lib/active_support/notifications.rb +22 -1
  30. data/lib/active_support/notifications/instrumenter.rb +2 -2
  31. data/lib/active_support/number_helper.rb +3 -2
  32. data/lib/active_support/per_thread_registry.rb +52 -0
  33. data/lib/active_support/subscriber.rb +93 -0
  34. data/lib/active_support/testing/constant_lookup.rb +2 -0
  35. data/lib/active_support/time_with_zone.rb +2 -0
  36. data/lib/active_support/values/time_zone.rb +5 -3
  37. data/lib/active_support/version.rb +7 -6
  38. data/lib/active_support/xml_mini/jdom.rb +6 -0
  39. data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
  40. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  41. metadata +14 -7
  42. data/lib/active_support/core_ext/string/xchar.rb +0 -18
@@ -38,6 +38,8 @@ module ActiveSupport
38
38
  begin
39
39
  constant = names.join("::").constantize
40
40
  break(constant) if yield(constant)
41
+ rescue NoMethodError # subclass of NameError
42
+ raise
41
43
  rescue NameError
42
44
  # Constant wasn't found, move on
43
45
  ensure
@@ -366,6 +366,8 @@ module ActiveSupport
366
366
  # TimeWithZone with the existing +time_zone+.
367
367
  def method_missing(sym, *args, &block)
368
368
  wrap_with_time_zone time.__send__(sym, *args, &block)
369
+ rescue NoMethodError => e
370
+ raise e, e.message.sub(time.inspect, self.inspect), e.backtrace
369
371
  end
370
372
 
371
373
  private
@@ -5,7 +5,7 @@ module ActiveSupport
5
5
  # The TimeZone class serves as a wrapper around TZInfo::Timezone instances.
6
6
  # It allows us to do the following:
7
7
  #
8
- # * Limit the set of zones provided by TZInfo to a meaningful subset of 142
8
+ # * Limit the set of zones provided by TZInfo to a meaningful subset of 146
9
9
  # zones.
10
10
  # * Retrieve and display zones with a friendlier name
11
11
  # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
@@ -62,6 +62,7 @@ module ActiveSupport
62
62
  "Newfoundland" => "America/St_Johns",
63
63
  "Brasilia" => "America/Sao_Paulo",
64
64
  "Buenos Aires" => "America/Argentina/Buenos_Aires",
65
+ "Montevideo" => "America/Montevideo",
65
66
  "Georgetown" => "America/Guyana",
66
67
  "Greenland" => "America/Godthab",
67
68
  "Mid-Atlantic" => "Atlantic/South_Georgia",
@@ -150,7 +151,7 @@ module ActiveSupport
150
151
  "Taipei" => "Asia/Taipei",
151
152
  "Perth" => "Australia/Perth",
152
153
  "Irkutsk" => "Asia/Irkutsk",
153
- "Ulaan Bataar" => "Asia/Ulaanbaatar",
154
+ "Ulaanbaatar" => "Asia/Ulaanbaatar",
154
155
  "Seoul" => "Asia/Seoul",
155
156
  "Osaka" => "Asia/Tokyo",
156
157
  "Sapporo" => "Asia/Tokyo",
@@ -176,6 +177,7 @@ module ActiveSupport
176
177
  "Wellington" => "Pacific/Auckland",
177
178
  "Nuku'alofa" => "Pacific/Tongatapu",
178
179
  "Tokelau Is." => "Pacific/Fakaofo",
180
+ "Chatham Is." => "Pacific/Chatham",
179
181
  "Samoa" => "Pacific/Apia"
180
182
  }
181
183
 
@@ -238,7 +240,7 @@ module ActiveSupport
238
240
  # Compare #name and TZInfo identifier to a supplied regexp, returning +true+
239
241
  # if a match is found.
240
242
  def =~(re)
241
- return true if name =~ re || MAPPING[name] =~ re
243
+ re === name || re === MAPPING[name]
242
244
  end
243
245
 
244
246
  # Returns a textual representation of this time zone.
@@ -1,10 +1,11 @@
1
1
  module ActiveSupport
2
- module VERSION #:nodoc:
3
- MAJOR = 4
4
- MINOR = 0
5
- TINY = 0
6
- PRE = "beta1"
2
+ # Returns the version of the currently loaded ActiveSupport as a Gem::Version
3
+ def self.version
4
+ Gem::Version.new "4.0.0.rc1"
5
+ end
7
6
 
8
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
7
+ module VERSION #:nodoc:
8
+ MAJOR, MINOR, TINY, PRE = ActiveSupport.version.segments
9
+ STRING = ActiveSupport.version.to_s
9
10
  end
10
11
  end
@@ -37,6 +37,12 @@ module ActiveSupport
37
37
  {}
38
38
  else
39
39
  @dbf = DocumentBuilderFactory.new_instance
40
+ # secure processing of java xml
41
+ # http://www.ibm.com/developerworks/xml/library/x-tipcfsx/index.html
42
+ @dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
43
+ @dbf.setFeature("http://xml.org/sax/features/external-general-entities", false)
44
+ @dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
45
+ @dbf.setFeature(javax.xml.XMLConstants::FEATURE_SECURE_PROCESSING, true)
40
46
  xml_string_reader = StringReader.new(data)
41
47
  xml_input_source = InputSource.new(xml_string_reader)
42
48
  doc = @dbf.new_document_builder.parse(xml_input_source)
@@ -32,7 +32,7 @@ module ActiveSupport
32
32
  end
33
33
 
34
34
  def on_start_element(name, attrs = {})
35
- new_hash = { CONTENT_KEY => '' }.merge(attrs)
35
+ new_hash = { CONTENT_KEY => '' }.merge!(attrs)
36
36
  new_hash[HASH_SIZE_KEY] = new_hash.size + 1
37
37
 
38
38
  case current_hash[name]
@@ -38,7 +38,7 @@ module ActiveSupport
38
38
  end
39
39
 
40
40
  def start_element(name, attrs = [])
41
- new_hash = { CONTENT_KEY => '' }.merge(Hash[attrs])
41
+ new_hash = { CONTENT_KEY => '' }.merge!(Hash[attrs])
42
42
  new_hash[HASH_SIZE_KEY] = new_hash.size + 1
43
43
 
44
44
  case current_hash[name]
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.0.0.beta1
4
+ version: 4.0.0.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: 2013-02-26 00:00:00.000000000 Z
11
+ date: 2013-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.2
19
+ version: '0.6'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.6.4
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: 0.6.2
29
+ version: '0.6'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.4
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: multi_json
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +50,14 @@ dependencies:
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
47
- version: 0.3.33
53
+ version: 0.3.37
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - ~>
53
59
  - !ruby/object:Gem::Version
54
- version: 0.3.33
60
+ version: 0.3.37
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: minitest
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -210,7 +216,6 @@ files:
210
216
  - lib/active_support/core_ext/string/output_safety.rb
211
217
  - lib/active_support/core_ext/string/starts_ends_with.rb
212
218
  - lib/active_support/core_ext/string/strip.rb
213
- - lib/active_support/core_ext/string/xchar.rb
214
219
  - lib/active_support/core_ext/string/zones.rb
215
220
  - lib/active_support/core_ext/string.rb
216
221
  - lib/active_support/core_ext/struct.rb
@@ -268,11 +273,13 @@ files:
268
273
  - lib/active_support/option_merger.rb
269
274
  - lib/active_support/ordered_hash.rb
270
275
  - lib/active_support/ordered_options.rb
276
+ - lib/active_support/per_thread_registry.rb
271
277
  - lib/active_support/proxy_object.rb
272
278
  - lib/active_support/rails.rb
273
279
  - lib/active_support/railtie.rb
274
280
  - lib/active_support/rescuable.rb
275
281
  - lib/active_support/string_inquirer.rb
282
+ - lib/active_support/subscriber.rb
276
283
  - lib/active_support/tagged_logging.rb
277
284
  - lib/active_support/test_case.rb
278
285
  - lib/active_support/testing/assertions.rb
@@ -1,18 +0,0 @@
1
- begin
2
- # See http://fast-xs.rubyforge.org/ by Eric Wong.
3
- # Also included with hpricot.
4
- require 'fast_xs'
5
- rescue LoadError
6
- # fast_xs extension unavailable
7
- else
8
- begin
9
- require 'builder'
10
- rescue LoadError
11
- # builder demands the first shot at defining String#to_xs
12
- end
13
-
14
- class String
15
- alias_method :original_xs, :to_xs if method_defined?(:to_xs)
16
- alias_method :to_xs, :fast_xs
17
- end
18
- end