activesupport 3.0.0.beta → 3.0.0.beta2

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 (73) hide show
  1. data/CHANGELOG +15 -1
  2. data/lib/active_support.rb +3 -0
  3. data/lib/active_support/all.rb +0 -1
  4. data/lib/active_support/cache/mem_cache_store.rb +1 -1
  5. data/lib/active_support/callbacks.rb +2 -2
  6. data/lib/active_support/core_ext/array/conversions.rb +0 -1
  7. data/lib/active_support/core_ext/array/extract_options.rb +16 -1
  8. data/lib/active_support/core_ext/class.rb +1 -0
  9. data/lib/active_support/core_ext/class/attribute.rb +30 -5
  10. data/lib/active_support/core_ext/class/attribute_accessors.rb +33 -27
  11. data/lib/active_support/core_ext/class/delegating_attributes.rb +10 -7
  12. data/lib/active_support/core_ext/class/subclasses.rb +55 -0
  13. data/lib/active_support/core_ext/date_time/conversions.rb +1 -0
  14. data/lib/active_support/core_ext/file/atomic.rb +3 -2
  15. data/lib/active_support/core_ext/file/path.rb +5 -0
  16. data/lib/active_support/core_ext/hash/conversions.rb +9 -0
  17. data/lib/active_support/core_ext/kernel.rb +0 -1
  18. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  19. data/lib/active_support/core_ext/kernel/reporting.rb +1 -1
  20. data/lib/active_support/core_ext/module.rb +5 -3
  21. data/lib/active_support/core_ext/module/anonymous.rb +24 -0
  22. data/lib/active_support/core_ext/module/attribute_accessors.rb +25 -21
  23. data/lib/active_support/core_ext/module/delegation.rb +20 -9
  24. data/lib/active_support/core_ext/module/introspection.rb +8 -8
  25. data/lib/active_support/core_ext/module/method_names.rb +14 -0
  26. data/lib/active_support/core_ext/module/reachable.rb +10 -0
  27. data/lib/active_support/core_ext/module/remove_method.rb +6 -0
  28. data/lib/active_support/core_ext/object.rb +7 -1
  29. data/lib/active_support/core_ext/object/extending.rb +11 -0
  30. data/lib/active_support/core_ext/object/singleton_class.rb +13 -0
  31. data/lib/active_support/core_ext/proc.rb +3 -3
  32. data/lib/active_support/core_ext/string/conversions.rb +1 -0
  33. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  34. data/lib/active_support/core_ext/string/interpolation.rb +1 -91
  35. data/lib/active_support/core_ext/string/output_safety.rb +12 -8
  36. data/lib/active_support/core_ext/string/xchar.rb +1 -1
  37. data/lib/active_support/core_ext/time/conversions.rb +1 -0
  38. data/lib/active_support/core_ext/time/marshal.rb +56 -0
  39. data/lib/active_support/dependencies.rb +146 -191
  40. data/lib/active_support/dependencies/autoload.rb +1 -0
  41. data/lib/active_support/deprecation/method_wrappers.rb +9 -9
  42. data/lib/active_support/deprecation/reporting.rb +2 -1
  43. data/lib/active_support/hash_with_indifferent_access.rb +4 -0
  44. data/lib/active_support/i18n.rb +2 -1
  45. data/lib/active_support/inflector/methods.rb +1 -1
  46. data/lib/active_support/inflector/transliterate.rb +3 -3
  47. data/lib/active_support/json/backends/yajl.rb +40 -0
  48. data/lib/active_support/json/decoding.rb +16 -1
  49. data/lib/active_support/lazy_load_hooks.rb +17 -0
  50. data/lib/active_support/memoizable.rb +1 -1
  51. data/lib/active_support/multibyte.rb +2 -2
  52. data/lib/active_support/multibyte/utils.rb +1 -1
  53. data/lib/active_support/notifications.rb +7 -3
  54. data/lib/active_support/notifications/fanout.rb +19 -5
  55. data/lib/active_support/ordered_options.rb +6 -0
  56. data/lib/active_support/railtie.rb +9 -9
  57. data/lib/active_support/ruby/shim.rb +2 -0
  58. data/lib/active_support/test_case.rb +2 -7
  59. data/lib/active_support/testing/assertions.rb +15 -0
  60. data/lib/active_support/testing/isolation.rb +2 -2
  61. data/lib/active_support/time.rb +1 -1
  62. data/lib/active_support/values/time_zone.rb +7 -4
  63. data/lib/active_support/version.rb +3 -2
  64. data/lib/active_support/whiny_nil.rb +4 -5
  65. data/lib/active_support/xml_mini/libxmlsax.rb +1 -0
  66. data/lib/active_support/xml_mini/nokogirisax.rb +1 -0
  67. data/lib/active_support/xml_mini/rexml.rb +7 -1
  68. metadata +65 -31
  69. data/lib/active_support/core_ext/kernel/daemonizing.rb +0 -7
  70. data/lib/active_support/core_ext/module/inclusion.rb +0 -30
  71. data/lib/active_support/core_ext/module/loading.rb +0 -25
  72. data/lib/active_support/core_ext/object/metaclass.rb +0 -13
  73. data/lib/active_support/core_ext/time/marshal_with_utc_flag.rb +0 -22
@@ -198,10 +198,12 @@ module ActiveSupport
198
198
  @name = name
199
199
  @utc_offset = utc_offset
200
200
  @tzinfo = tzinfo
201
+ @current_period = nil
201
202
  end
202
203
 
203
204
  def utc_offset
204
- @utc_offset ||= tzinfo.current_period.utc_offset
205
+ @current_period ||= tzinfo.current_period
206
+ @current_period.utc_offset
205
207
  end
206
208
 
207
209
  # Returns the offset of this time zone as a formatted string, of the
@@ -305,8 +307,8 @@ module ActiveSupport
305
307
 
306
308
  # TODO: Preload instead of lazy load for thread safety
307
309
  def tzinfo
308
- require 'tzinfo' unless defined?(TZInfo)
309
- @tzinfo ||= TZInfo::Timezone.get(MAPPING[name])
310
+ require 'tzinfo' unless defined?(::TZInfo)
311
+ @tzinfo ||= ::TZInfo::Timezone.get(MAPPING[name])
310
312
  end
311
313
 
312
314
  unless const_defined?(:ZONES)
@@ -362,13 +364,14 @@ module ActiveSupport
362
364
  "Wellington" ],
363
365
  [ 46_800, "Nuku'alofa" ]].
364
366
  each do |offset, *places|
365
- places.sort.each do |place|
367
+ places.each do |place|
366
368
  place.freeze
367
369
  zone = new(place, offset)
368
370
  ZONES << zone
369
371
  ZONES_MAP[place] = zone
370
372
  end
371
373
  end
374
+ ZONES.sort!
372
375
  ZONES.freeze
373
376
  ZONES_MAP.freeze
374
377
 
@@ -2,8 +2,9 @@ module ActiveSupport
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = "0.beta"
5
+ TINY = 0
6
+ BUILD = "beta2"
6
7
 
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
+ STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
8
9
  end
9
10
  end
@@ -11,7 +11,7 @@
11
11
  # classes in NilClass::WHINERS the error message suggests which could be the
12
12
  # actual intended class:
13
13
  #
14
- # $ script/runner nil.destroy
14
+ # $ rails runner nil.destroy
15
15
  # ...
16
16
  # You might have expected an instance of ActiveRecord::Base.
17
17
  # ...
@@ -25,17 +25,16 @@
25
25
  # By default it is on in development and test modes, and it is off in production
26
26
  # mode.
27
27
  class NilClass
28
- WHINERS = [::Array]
29
- WHINERS << ::ActiveRecord::Base if defined? ::ActiveRecord
30
-
31
28
  METHOD_CLASS_MAP = Hash.new
32
29
 
33
- WHINERS.each do |klass|
30
+ def self.add_whiner(klass)
34
31
  methods = klass.public_instance_methods - public_instance_methods
35
32
  class_name = klass.name
36
33
  methods.each { |method| METHOD_CLASS_MAP[method.to_sym] = class_name }
37
34
  end
38
35
 
36
+ add_whiner ::Array
37
+
39
38
  # Raises a RuntimeError when you attempt to call +id+ on +nil+.
40
39
  def id
41
40
  raise RuntimeError, "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id", caller
@@ -1,4 +1,5 @@
1
1
  require 'libxml'
2
+ require 'active_support/core_ext/object/blank'
2
3
 
3
4
  # = XmlMini LibXML implementation using a SAX-based parser
4
5
  module ActiveSupport
@@ -1,4 +1,5 @@
1
1
  require 'nokogiri'
2
+ require 'active_support/core_ext/object/blank'
2
3
 
3
4
  # = XmlMini Nokogiri implementation using a SAX-based parser
4
5
  module ActiveSupport
@@ -27,7 +27,13 @@ module ActiveSupport
27
27
  data.ungetc(char)
28
28
  silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
29
29
  doc = REXML::Document.new(data)
30
- merge_element!({}, doc.root)
30
+
31
+ if doc.root
32
+ merge_element!({}, doc.root)
33
+ else
34
+ raise REXML::ParseException,
35
+ "The document #{doc.to_s.inspect} does not have a valid root"
36
+ end
31
37
  end
32
38
  end
33
39
 
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta
4
+ prerelease: true
5
+ segments:
6
+ - 3
7
+ - 0
8
+ - 0
9
+ - beta2
10
+ version: 3.0.0.beta2
5
11
  platform: ruby
6
12
  authors:
7
13
  - David Heinemeier Hansson
@@ -9,50 +15,66 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-04 00:00:00 -08:00
18
+ date: 2010-04-01 00:00:00 -07:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: i18n
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: 0.3.0
24
- version:
28
+ segments:
29
+ - 0
30
+ - 3
31
+ - 6
32
+ version: 0.3.6
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: tzinfo
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
30
39
  requirements:
31
40
  - - ~>
32
41
  - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 3
45
+ - 16
33
46
  version: 0.3.16
34
- version:
47
+ type: :runtime
48
+ version_requirements: *id002
35
49
  - !ruby/object:Gem::Dependency
36
50
  name: builder
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
40
53
  requirements:
41
54
  - - ~>
42
55
  - !ruby/object:Gem::Version
56
+ segments:
57
+ - 2
58
+ - 1
59
+ - 2
43
60
  version: 2.1.2
44
- version:
61
+ type: :runtime
62
+ version_requirements: *id003
45
63
  - !ruby/object:Gem::Dependency
46
64
  name: memcache-client
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
50
67
  requirements:
51
- - - ~>
68
+ - - ">="
52
69
  - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 7
73
+ - 5
53
74
  version: 1.7.5
54
- version:
55
- description: Support and utility classes used by the Rails framework.
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ 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.
56
78
  email: david@loudthinking.com
57
79
  executables: []
58
80
 
@@ -96,6 +118,7 @@ files:
96
118
  - lib/active_support/core_ext/class/attribute_accessors.rb
97
119
  - lib/active_support/core_ext/class/delegating_attributes.rb
98
120
  - lib/active_support/core_ext/class/inheritable_attributes.rb
121
+ - lib/active_support/core_ext/class/subclasses.rb
99
122
  - lib/active_support/core_ext/class.rb
100
123
  - lib/active_support/core_ext/date/acts_like.rb
101
124
  - lib/active_support/core_ext/date/calculations.rb
@@ -108,6 +131,7 @@ files:
108
131
  - lib/active_support/core_ext/enumerable.rb
109
132
  - lib/active_support/core_ext/exception.rb
110
133
  - lib/active_support/core_ext/file/atomic.rb
134
+ - lib/active_support/core_ext/file/path.rb
111
135
  - lib/active_support/core_ext/file.rb
112
136
  - lib/active_support/core_ext/float/rounding.rb
113
137
  - lib/active_support/core_ext/float.rb
@@ -125,7 +149,6 @@ files:
125
149
  - lib/active_support/core_ext/integer/time.rb
126
150
  - lib/active_support/core_ext/integer.rb
127
151
  - lib/active_support/core_ext/kernel/agnostics.rb
128
- - lib/active_support/core_ext/kernel/daemonizing.rb
129
152
  - lib/active_support/core_ext/kernel/debugger.rb
130
153
  - lib/active_support/core_ext/kernel/reporting.rb
131
154
  - lib/active_support/core_ext/kernel/requires.rb
@@ -133,14 +156,16 @@ files:
133
156
  - lib/active_support/core_ext/load_error.rb
134
157
  - lib/active_support/core_ext/logger.rb
135
158
  - lib/active_support/core_ext/module/aliasing.rb
159
+ - lib/active_support/core_ext/module/anonymous.rb
136
160
  - lib/active_support/core_ext/module/attr_accessor_with_default.rb
137
161
  - lib/active_support/core_ext/module/attr_internal.rb
138
162
  - lib/active_support/core_ext/module/attribute_accessors.rb
139
163
  - lib/active_support/core_ext/module/delegation.rb
140
164
  - lib/active_support/core_ext/module/deprecation.rb
141
- - lib/active_support/core_ext/module/inclusion.rb
142
165
  - lib/active_support/core_ext/module/introspection.rb
143
- - lib/active_support/core_ext/module/loading.rb
166
+ - lib/active_support/core_ext/module/method_names.rb
167
+ - lib/active_support/core_ext/module/reachable.rb
168
+ - lib/active_support/core_ext/module/remove_method.rb
144
169
  - lib/active_support/core_ext/module/synchronization.rb
145
170
  - lib/active_support/core_ext/module.rb
146
171
  - lib/active_support/core_ext/name_error.rb
@@ -151,10 +176,11 @@ files:
151
176
  - lib/active_support/core_ext/object/blank.rb
152
177
  - lib/active_support/core_ext/object/conversions.rb
153
178
  - lib/active_support/core_ext/object/duplicable.rb
179
+ - lib/active_support/core_ext/object/extending.rb
154
180
  - lib/active_support/core_ext/object/instance_variables.rb
155
- - lib/active_support/core_ext/object/metaclass.rb
156
181
  - lib/active_support/core_ext/object/misc.rb
157
182
  - lib/active_support/core_ext/object/returning.rb
183
+ - lib/active_support/core_ext/object/singleton_class.rb
158
184
  - lib/active_support/core_ext/object/to_param.rb
159
185
  - lib/active_support/core_ext/object/to_query.rb
160
186
  - lib/active_support/core_ext/object/try.rb
@@ -185,7 +211,7 @@ files:
185
211
  - lib/active_support/core_ext/time/acts_like.rb
186
212
  - lib/active_support/core_ext/time/calculations.rb
187
213
  - lib/active_support/core_ext/time/conversions.rb
188
- - lib/active_support/core_ext/time/marshal_with_utc_flag.rb
214
+ - lib/active_support/core_ext/time/marshal.rb
189
215
  - lib/active_support/core_ext/time/publicize_conversion_methods.rb
190
216
  - lib/active_support/core_ext/time/zones.rb
191
217
  - lib/active_support/core_ext/uri.rb
@@ -207,11 +233,13 @@ files:
207
233
  - lib/active_support/inflector/transliterate.rb
208
234
  - lib/active_support/inflector.rb
209
235
  - lib/active_support/json/backends/jsongem.rb
236
+ - lib/active_support/json/backends/yajl.rb
210
237
  - lib/active_support/json/backends/yaml.rb
211
238
  - lib/active_support/json/decoding.rb
212
239
  - lib/active_support/json/encoding.rb
213
240
  - lib/active_support/json/variable.rb
214
241
  - lib/active_support/json.rb
242
+ - lib/active_support/lazy_load_hooks.rb
215
243
  - lib/active_support/locale/en.yml
216
244
  - lib/active_support/memoizable.rb
217
245
  - lib/active_support/message_encryptor.rb
@@ -269,20 +297,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
297
  requirements:
270
298
  - - ">="
271
299
  - !ruby/object:Gem::Version
272
- version: "0"
273
- version:
300
+ segments:
301
+ - 1
302
+ - 8
303
+ - 7
304
+ version: 1.8.7
274
305
  required_rubygems_version: !ruby/object:Gem::Requirement
275
306
  requirements:
276
307
  - - ">"
277
308
  - !ruby/object:Gem::Version
309
+ segments:
310
+ - 1
311
+ - 3
312
+ - 1
278
313
  version: 1.3.1
279
- version:
280
314
  requirements: []
281
315
 
282
316
  rubyforge_project: activesupport
283
- rubygems_version: 1.3.5
317
+ rubygems_version: 1.3.6
284
318
  signing_key:
285
319
  specification_version: 3
286
- summary: Support and utility classes used by the Rails framework.
320
+ summary: A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
287
321
  test_files: []
288
322
 
@@ -1,7 +0,0 @@
1
- module Kernel
2
- # Turns the current script into a daemon process that detaches from the console.
3
- # It can be shut down with a TERM signal.
4
- def daemonize
5
- Process.daemon
6
- end
7
- end
@@ -1,30 +0,0 @@
1
- class Module
2
- # Returns the classes in the current ObjectSpace where this module has been
3
- # mixed in according to Module#included_modules.
4
- #
5
- # module M
6
- # end
7
- #
8
- # module N
9
- # include M
10
- # end
11
- #
12
- # class C
13
- # include M
14
- # end
15
- #
16
- # class D < C
17
- # end
18
- #
19
- # p M.included_in_classes # => [C, D]
20
- #
21
- def included_in_classes
22
- classes = []
23
- ObjectSpace.each_object(Class) { |k| classes << k if k.included_modules.include?(self) }
24
-
25
- classes.reverse.inject([]) do |unique_classes, klass|
26
- unique_classes << klass unless unique_classes.collect { |k| k.to_s }.include?(klass.to_s)
27
- unique_classes
28
- end
29
- end
30
- end
@@ -1,25 +0,0 @@
1
- require 'active_support/core_ext/string/inflections'
2
-
3
- class Module
4
- # Returns String#underscore applied to the module name minus trailing classes.
5
- #
6
- # ActiveRecord.as_load_path # => "active_record"
7
- # ActiveRecord::Associations.as_load_path # => "active_record/associations"
8
- # ActiveRecord::Base.as_load_path # => "active_record" (Base is a class)
9
- #
10
- # The Kernel module gives an empty string by definition.
11
- #
12
- # Kernel.as_load_path # => ""
13
- # Math.as_load_path # => "math"
14
- def as_load_path
15
- if self == Object || self == Kernel
16
- ''
17
- elsif is_a? Class
18
- parent == self ? '' : parent.as_load_path
19
- else
20
- name.split('::').collect do |word|
21
- word.underscore
22
- end * '/'
23
- end
24
- end
25
- end
@@ -1,13 +0,0 @@
1
- class Object
2
- # Get object's meta (ghost, eigenclass, singleton) class
3
- def metaclass
4
- class << self
5
- self
6
- end
7
- end
8
-
9
- # If class_eval is called on an object, add those methods to its metaclass
10
- def class_eval(*args, &block)
11
- metaclass.class_eval(*args, &block)
12
- end
13
- end
@@ -1,22 +0,0 @@
1
- # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2
- # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3
- # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4
- if RUBY_VERSION < '1.9'
5
- class Time
6
- class << self
7
- alias_method :_original_load, :_load
8
- def _load(marshaled_time)
9
- time = _original_load(marshaled_time)
10
- utc = time.instance_variable_get('@marshal_with_utc_coercion')
11
- utc ? time.utc : time
12
- end
13
- end
14
-
15
- alias_method :_original_dump, :_dump
16
- def _dump(*args)
17
- obj = frozen? ? dup : self
18
- obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
19
- obj._original_dump(*args)
20
- end
21
- end
22
- end