activesupport 3.0.0.rc → 3.0.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.

Files changed (68) hide show
  1. data/CHANGELOG +42 -37
  2. data/lib/active_support/base64.rb +3 -3
  3. data/lib/active_support/benchmarkable.rb +3 -3
  4. data/lib/active_support/cache.rb +46 -56
  5. data/lib/active_support/cache/mem_cache_store.rb +3 -4
  6. data/lib/active_support/cache/memory_store.rb +5 -5
  7. data/lib/active_support/cache/strategy/local_cache.rb +5 -5
  8. data/lib/active_support/callbacks.rb +13 -3
  9. data/lib/active_support/concern.rb +35 -0
  10. data/lib/active_support/configurable.rb +2 -2
  11. data/lib/active_support/core_ext/array/conversions.rb +6 -6
  12. data/lib/active_support/core_ext/array/random_access.rb +4 -4
  13. data/lib/active_support/core_ext/array/uniq_by.rb +1 -1
  14. data/lib/active_support/core_ext/array/wrap.rb +30 -4
  15. data/lib/active_support/core_ext/class/attribute.rb +27 -4
  16. data/lib/active_support/core_ext/class/attribute_accessors.rb +16 -0
  17. data/lib/active_support/core_ext/class/inheritable_attributes.rb +25 -3
  18. data/lib/active_support/core_ext/date/calculations.rb +15 -15
  19. data/lib/active_support/core_ext/date_time/conversions.rb +6 -6
  20. data/lib/active_support/core_ext/date_time/zones.rb +1 -1
  21. data/lib/active_support/core_ext/enumerable.rb +6 -5
  22. data/lib/active_support/core_ext/hash/conversions.rb +11 -11
  23. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -3
  24. data/lib/active_support/core_ext/integer/time.rb +2 -2
  25. data/lib/active_support/core_ext/kernel/reporting.rb +1 -1
  26. data/lib/active_support/core_ext/module/anonymous.rb +1 -1
  27. data/lib/active_support/core_ext/module/attr_accessor_with_default.rb +2 -2
  28. data/lib/active_support/core_ext/module/attribute_accessors.rb +1 -1
  29. data/lib/active_support/core_ext/module/remove_method.rb +1 -1
  30. data/lib/active_support/core_ext/module/synchronization.rb +2 -2
  31. data/lib/active_support/core_ext/numeric/time.rb +9 -9
  32. data/lib/active_support/core_ext/object.rb +1 -0
  33. data/lib/active_support/core_ext/object/blank.rb +1 -1
  34. data/lib/active_support/core_ext/object/instance_variables.rb +5 -5
  35. data/lib/active_support/core_ext/object/returning.rb +43 -0
  36. data/lib/active_support/core_ext/range/conversions.rb +1 -1
  37. data/lib/active_support/core_ext/string/access.rb +7 -7
  38. data/lib/active_support/core_ext/string/inflections.rb +8 -6
  39. data/lib/active_support/core_ext/string/multibyte.rb +5 -5
  40. data/lib/active_support/core_ext/time/calculations.rb +2 -2
  41. data/lib/active_support/core_ext/time/conversions.rb +1 -1
  42. data/lib/active_support/core_ext/time/zones.rb +3 -3
  43. data/lib/active_support/dependencies.rb +56 -38
  44. data/lib/active_support/duration.rb +1 -1
  45. data/lib/active_support/hash_with_indifferent_access.rb +9 -3
  46. data/lib/active_support/i18n_railtie.rb +1 -1
  47. data/lib/active_support/lazy_load_hooks.rb +20 -1
  48. data/lib/active_support/locale/en.yml +3 -3
  49. data/lib/active_support/log_subscriber.rb +32 -33
  50. data/lib/active_support/log_subscriber/test_helper.rb +1 -1
  51. data/lib/active_support/message_encryptor.rb +17 -17
  52. data/lib/active_support/message_verifier.rb +7 -7
  53. data/lib/active_support/multibyte.rb +1 -1
  54. data/lib/active_support/multibyte/chars.rb +37 -36
  55. data/lib/active_support/multibyte/unicode.rb +4 -4
  56. data/lib/active_support/notifications.rb +3 -3
  57. data/lib/active_support/secure_random.rb +13 -13
  58. data/lib/active_support/testing/assertions.rb +8 -6
  59. data/lib/active_support/testing/declarative.rb +4 -4
  60. data/lib/active_support/testing/isolation.rb +1 -1
  61. data/lib/active_support/testing/pending.rb +3 -3
  62. data/lib/active_support/testing/performance.rb +9 -5
  63. data/lib/active_support/time_with_zone.rb +2 -2
  64. data/lib/active_support/version.rb +1 -1
  65. data/lib/active_support/xml_mini/nokogiri.rb +6 -1
  66. data/lib/active_support/xml_mini/nokogirisax.rb +7 -2
  67. data/lib/active_support/xml_mini/rexml.rb +1 -1
  68. metadata +5 -4
@@ -63,19 +63,21 @@ module ActiveSupport
63
63
  def assert_no_difference(expression, message = nil, &block)
64
64
  assert_difference expression, 0, message, &block
65
65
  end
66
-
66
+
67
67
  # Test if an expression is blank. Passes if object.blank? is true.
68
68
  #
69
69
  # assert_blank [] # => true
70
- def assert_blank(object)
71
- assert object.blank?, "#{object.inspect} is not blank"
70
+ def assert_blank(object, message=nil)
71
+ message ||= "#{object.inspect} is not blank"
72
+ assert object.blank?, message
72
73
  end
73
-
74
+
74
75
  # Test if an expression is not blank. Passes if object.present? is true.
75
76
  #
76
77
  # assert_present {:data => 'x' } # => true
77
- def assert_present(object)
78
- assert object.present?, "#{object.inspect} is blank"
78
+ def assert_present(object, message=nil)
79
+ message ||= "#{object.inspect} is blank"
80
+ assert object.present?, message
79
81
  end
80
82
  end
81
83
  end
@@ -1,10 +1,10 @@
1
1
  module ActiveSupport
2
2
  module Testing
3
3
  module Declarative
4
-
4
+
5
5
  def self.extended(klass)
6
6
  klass.class_eval do
7
-
7
+
8
8
  unless method_defined?(:describe)
9
9
  def self.describe(text)
10
10
  class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
@@ -14,9 +14,9 @@ module ActiveSupport
14
14
  RUBY_EVAL
15
15
  end
16
16
  end
17
-
17
+
18
18
  end
19
- end
19
+ end
20
20
 
21
21
  unless defined?(Spec)
22
22
  # test "verify something" do
@@ -34,7 +34,7 @@ module ActiveSupport
34
34
 
35
35
  module Isolation
36
36
  def self.forking_env?
37
- !ENV["NO_FORK"] && ((Config::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
37
+ !ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
38
38
  end
39
39
 
40
40
  def self.included(base)
@@ -25,13 +25,13 @@ module ActiveSupport
25
25
  failed = true
26
26
  end
27
27
 
28
- flunk("<#{description}> did not fail.") unless failed
28
+ flunk("<#{description}> did not fail.") unless failed
29
29
  end
30
30
 
31
31
  caller[0] =~ (/(.*):(.*):in `(.*)'/)
32
32
  @@pending_cases << "#{$3} at #{$1}, line #{$2}"
33
33
  print "P"
34
-
34
+
35
35
  @@at_exit ||= begin
36
36
  at_exit do
37
37
  puts "\nPending Cases:"
@@ -42,7 +42,7 @@ module ActiveSupport
42
42
  end
43
43
  end
44
44
  end
45
-
45
+
46
46
  end
47
47
  end
48
48
  end
@@ -178,7 +178,7 @@ begin
178
178
  RubyProf.pause
179
179
  profile_options[:runs].to_i.times { run_test(@metric, :profile) }
180
180
  @data = RubyProf.stop
181
- @total = @data.threads.values.sum(0) { |method_infos| method_infos.sort.last.total_time }
181
+ @total = @data.threads.values.sum(0) { |method_infos| method_infos.max.total_time }
182
182
  end
183
183
 
184
184
  def report
@@ -207,10 +207,14 @@ begin
207
207
  def output_filename(printer_class)
208
208
  suffix =
209
209
  case printer_class.name.demodulize
210
- when 'FlatPrinter'; 'flat.txt'
211
- when 'GraphPrinter'; 'graph.txt'
212
- when 'GraphHtmlPrinter'; 'graph.html'
213
- when 'CallTreePrinter'; 'tree.txt'
210
+ when 'FlatPrinter'; 'flat.txt'
211
+ when 'FlatPrinterWithLineNumbers'; 'flat_line_numbers.txt'
212
+ when 'GraphPrinter'; 'graph.txt'
213
+ when 'GraphHtmlPrinter'; 'graph.html'
214
+ when 'GraphYamlPrinter'; 'graph.yml'
215
+ when 'CallTreePrinter'; 'tree.txt'
216
+ when 'CallStackPrinter'; 'stack.html'
217
+ when 'DotPrinter'; 'graph.dot'
214
218
  else printer_class.name.sub(/Printer$/, '').underscore
215
219
  end
216
220
 
@@ -18,7 +18,7 @@ module ActiveSupport
18
18
  #
19
19
  # See Time and TimeZone for further documentation of these methods.
20
20
  #
21
- # TimeWithZone instances implement the same API as Ruby Time instances, so that Time and TimeWithZone instances are interchangeable.
21
+ # TimeWithZone instances implement the same API as Ruby Time instances, so that Time and TimeWithZone instances are interchangeable.
22
22
  # Examples:
23
23
  #
24
24
  # t = Time.zone.now # => Sun, 18 May 2008 13:27:25 EDT -04:00
@@ -36,7 +36,7 @@ module ActiveSupport
36
36
  def self.name
37
37
  'Time' # Report class name as 'Time' to thwart type checking
38
38
  end
39
-
39
+
40
40
  include Comparable
41
41
  attr_reader :time_zone
42
42
 
@@ -3,7 +3,7 @@ module ActiveSupport
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
- BUILD = "rc"
6
+ BUILD = "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
9
9
  end
@@ -1,4 +1,9 @@
1
- require 'nokogiri'
1
+ begin
2
+ require 'nokogiri'
3
+ rescue LoadError => e
4
+ $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
5
+ raise e
6
+ end
2
7
  require 'active_support/core_ext/object/blank'
3
8
 
4
9
  # = XmlMini Nokogiri implementation
@@ -1,4 +1,9 @@
1
- require 'nokogiri'
1
+ begin
2
+ require 'nokogiri'
3
+ rescue LoadError => e
4
+ $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
5
+ raise e
6
+ end
2
7
  require 'active_support/core_ext/object/blank'
3
8
 
4
9
  # = XmlMini Nokogiri implementation using a SAX-based parser
@@ -80,4 +85,4 @@ module ActiveSupport
80
85
  end
81
86
  end
82
87
  end
83
- end
88
+ end
@@ -19,7 +19,7 @@ module ActiveSupport
19
19
  if !data.respond_to?(:read)
20
20
  data = StringIO.new(data || '')
21
21
  end
22
-
22
+
23
23
  char = data.getc
24
24
  if char.nil?
25
25
  {}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7712042
4
+ hash: 977940607
5
5
  prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
- - rc
11
- version: 3.0.0.rc
10
+ - rc2
11
+ version: 3.0.0.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - David Heinemeier Hansson
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-26 00:00:00 -05:00
19
+ date: 2010-08-23 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -126,6 +126,7 @@ files:
126
126
  - lib/active_support/core_ext/object/conversions.rb
127
127
  - lib/active_support/core_ext/object/duplicable.rb
128
128
  - lib/active_support/core_ext/object/instance_variables.rb
129
+ - lib/active_support/core_ext/object/returning.rb
129
130
  - lib/active_support/core_ext/object/to_json.rb
130
131
  - lib/active_support/core_ext/object/to_param.rb
131
132
  - lib/active_support/core_ext/object/to_query.rb