activesupport 1.4.2 → 1.4.3
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.
- data/CHANGELOG +11 -0
- data/lib/active_support/core_ext/blank.rb +9 -3
- data/lib/active_support/core_ext/hash/conversions.rb +24 -3
- data/lib/active_support/core_ext/module/introspection.rb +14 -0
- data/lib/active_support/dependencies.rb +3 -3
- data/lib/active_support/multibyte/chars.rb +6 -6
- data/lib/active_support/version.rb +1 -1
- metadata +56 -56
data/CHANGELOG
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
*1.4.3* (October 4th, 2007)
|
2
|
+
|
3
|
+
* Demote Hash#to_xml to use XmlSimple#xml_in_string so it can't read files or stdin. #8453 [candlerb, Jeremy Kemper]
|
4
|
+
|
5
|
+
* Document Object#blank?. #6491 [Chris Mear]
|
6
|
+
|
7
|
+
* Update Dependencies to ignore constants inherited from ancestors. Closes #6951. [Nicholas Seckar]
|
8
|
+
|
9
|
+
* Improved multibyte performance by relying less on exception raising #8159 [Blaine]
|
10
|
+
|
11
|
+
|
1
12
|
*1.4.2* (March 12th, 2007)
|
2
13
|
|
3
14
|
* Ruby 1.8.6 and 1.9 define private Time#to_date and #to_datetime; make them
|
@@ -1,5 +1,11 @@
|
|
1
|
-
class Object
|
2
|
-
#
|
1
|
+
class Object
|
2
|
+
# An object is blank if it's nil, empty, or a whitespace string.
|
3
|
+
# For example, "", " ", nil, [], and {} are blank.
|
4
|
+
#
|
5
|
+
# This simplifies
|
6
|
+
# if !address.nil? && !address.empty?
|
7
|
+
# to
|
8
|
+
# if !address.blank?
|
3
9
|
def blank?
|
4
10
|
if respond_to?(:empty?) && respond_to?(:strip)
|
5
11
|
empty? or strip.empty?
|
@@ -47,4 +53,4 @@ class Numeric #:nodoc:
|
|
47
53
|
def blank?
|
48
54
|
false
|
49
55
|
end
|
50
|
-
end
|
56
|
+
end
|
@@ -1,6 +1,27 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'xml_simple'
|
3
3
|
|
4
|
+
# Locked down XmlSimple#xml_in_string
|
5
|
+
class XmlSimple
|
6
|
+
# Same as xml_in but doesn't try to smartly shoot itself in the foot.
|
7
|
+
def xml_in_string(string, options = nil)
|
8
|
+
handle_options('in', options)
|
9
|
+
|
10
|
+
@doc = parse(string)
|
11
|
+
result = collapse(@doc.root)
|
12
|
+
|
13
|
+
if @options['keeproot']
|
14
|
+
merge({}, @doc.root.name, result)
|
15
|
+
else
|
16
|
+
result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.xml_in_string(string, options = nil)
|
21
|
+
new.xml_in_string(string, options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
4
25
|
module ActiveSupport #:nodoc:
|
5
26
|
module CoreExtensions #:nodoc:
|
6
27
|
module Hash #:nodoc:
|
@@ -81,14 +102,14 @@ module ActiveSupport #:nodoc:
|
|
81
102
|
module ClassMethods
|
82
103
|
def from_xml(xml)
|
83
104
|
# TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple
|
84
|
-
undasherize_keys(typecast_xml_value(XmlSimple.
|
105
|
+
undasherize_keys(typecast_xml_value(XmlSimple.xml_in_string(xml,
|
85
106
|
'forcearray' => false,
|
86
107
|
'forcecontent' => true,
|
87
108
|
'keeproot' => true,
|
88
109
|
'contentkey' => '__content__')
|
89
|
-
))
|
110
|
+
))
|
90
111
|
end
|
91
|
-
|
112
|
+
|
92
113
|
def create_from_xml(xml)
|
93
114
|
ActiveSupport::Deprecation.warn("Hash.create_from_xml has been renamed to Hash.from_xml", caller)
|
94
115
|
from_xml(xml)
|
@@ -18,4 +18,18 @@ class Module
|
|
18
18
|
parents << Object unless parents.include? Object
|
19
19
|
parents
|
20
20
|
end
|
21
|
+
|
22
|
+
# Return the constants that have been defined locally by this object and not
|
23
|
+
# in an ancestor. This method may miss some constants if their definition in
|
24
|
+
# the ancestor is identical to their definition in the receiver.
|
25
|
+
def local_constants
|
26
|
+
inherited = {}
|
27
|
+
ancestors.each do |anc|
|
28
|
+
next if anc == self
|
29
|
+
anc.constants.each { |const| inherited[const] = anc.const_get(const) }
|
30
|
+
end
|
31
|
+
constants.select do |const|
|
32
|
+
! inherited.key?(const) || inherited[const].object_id != const_get(const).object_id
|
33
|
+
end
|
34
|
+
end
|
21
35
|
end
|
@@ -318,13 +318,13 @@ module Dependencies #:nodoc:
|
|
318
318
|
watch_frames = descs.collect do |desc|
|
319
319
|
if desc.is_a? Module
|
320
320
|
mod_name = desc.name
|
321
|
-
initial_constants = desc.
|
321
|
+
initial_constants = desc.local_constants
|
322
322
|
elsif desc.is_a?(String) || desc.is_a?(Symbol)
|
323
323
|
mod_name = desc.to_s
|
324
324
|
|
325
325
|
# Handle the case where the module has yet to be defined.
|
326
326
|
initial_constants = if qualified_const_defined?(mod_name)
|
327
|
-
mod_name.constantize.
|
327
|
+
mod_name.constantize.local_constants
|
328
328
|
else
|
329
329
|
[]
|
330
330
|
end
|
@@ -349,7 +349,7 @@ module Dependencies #:nodoc:
|
|
349
349
|
|
350
350
|
mod = mod_name.constantize
|
351
351
|
next [] unless mod.is_a? Module
|
352
|
-
new_constants = mod.
|
352
|
+
new_constants = mod.local_constants - prior_constants
|
353
353
|
|
354
354
|
# Make sure no other frames takes credit for these constants.
|
355
355
|
constant_watch_stack.each do |frame_name, constants|
|
@@ -43,7 +43,7 @@ module ActiveSupport::Multibyte #:nodoc:
|
|
43
43
|
|
44
44
|
# Create a new Chars instance.
|
45
45
|
def initialize(str)
|
46
|
-
@string = (str.string
|
46
|
+
@string = str.respond_to?(:string) ? str.string : str
|
47
47
|
end
|
48
48
|
|
49
49
|
# Returns -1, 0 or +1 depending on whether the Chars object is to be sorted before, equal or after the
|
@@ -70,18 +70,18 @@ module ActiveSupport::Multibyte #:nodoc:
|
|
70
70
|
def method_missing(m, *a, &b)
|
71
71
|
begin
|
72
72
|
# Simulate methods with a ! at the end because we can't touch the enclosed string from the handlers.
|
73
|
-
if m.to_s =~ /^(.*)\!$/
|
73
|
+
if m.to_s =~ /^(.*)\!$/ && handler.respond_to?($1)
|
74
74
|
result = handler.send($1, @string, *a, &b)
|
75
75
|
if result == @string
|
76
76
|
result = nil
|
77
77
|
else
|
78
78
|
@string.replace result
|
79
79
|
end
|
80
|
-
|
80
|
+
elsif handler.respond_to?(m)
|
81
81
|
result = handler.send(m, @string, *a, &b)
|
82
|
+
else
|
83
|
+
result = @string.send(m, *a, &b)
|
82
84
|
end
|
83
|
-
rescue NoMethodError
|
84
|
-
result = @string.send(m, *a, &b)
|
85
85
|
rescue Handlers::EncodingError
|
86
86
|
@string.replace handler.tidy_bytes(@string)
|
87
87
|
retry
|
@@ -126,4 +126,4 @@ begin
|
|
126
126
|
ActiveSupport::Multibyte::Chars.handler = ActiveSupport::Multibyte::Handlers::UTF8HandlerProc
|
127
127
|
rescue LoadError
|
128
128
|
ActiveSupport::Multibyte::Chars.handler = ActiveSupport::Multibyte::Handlers::UTF8Handler
|
129
|
-
end
|
129
|
+
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: activesupport
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.4.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.4.3
|
7
|
+
date: 2007-10-04 00:00:00 -05:00
|
8
8
|
summary: Support and utility classes used by the Rails framework.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,85 +32,52 @@ files:
|
|
32
32
|
- CHANGELOG
|
33
33
|
- README
|
34
34
|
- lib/active_support
|
35
|
-
- lib/active_support.rb
|
36
35
|
- lib/active_support/binding_of_caller.rb
|
37
36
|
- lib/active_support/breakpoint.rb
|
38
37
|
- lib/active_support/caching_tools.rb
|
39
38
|
- lib/active_support/clean_logger.rb
|
40
39
|
- lib/active_support/core_ext
|
41
|
-
- lib/active_support/core_ext.rb
|
42
|
-
- lib/active_support/dependencies.rb
|
43
|
-
- lib/active_support/deprecation.rb
|
44
|
-
- lib/active_support/inflections.rb
|
45
|
-
- lib/active_support/inflector.rb
|
46
|
-
- lib/active_support/json
|
47
|
-
- lib/active_support/json.rb
|
48
|
-
- lib/active_support/multibyte
|
49
|
-
- lib/active_support/multibyte.rb
|
50
|
-
- lib/active_support/option_merger.rb
|
51
|
-
- lib/active_support/ordered_options.rb
|
52
|
-
- lib/active_support/reloadable.rb
|
53
|
-
- lib/active_support/values
|
54
|
-
- lib/active_support/vendor
|
55
|
-
- lib/active_support/version.rb
|
56
|
-
- lib/active_support/whiny_nil.rb
|
57
40
|
- lib/active_support/core_ext/array
|
41
|
+
- lib/active_support/core_ext/array/conversions.rb
|
42
|
+
- lib/active_support/core_ext/array/grouping.rb
|
58
43
|
- lib/active_support/core_ext/array.rb
|
59
44
|
- lib/active_support/core_ext/bigdecimal
|
45
|
+
- lib/active_support/core_ext/bigdecimal/formatting.rb
|
60
46
|
- lib/active_support/core_ext/bigdecimal.rb
|
61
47
|
- lib/active_support/core_ext/blank.rb
|
62
48
|
- lib/active_support/core_ext/cgi
|
49
|
+
- lib/active_support/core_ext/cgi/escape_skipping_slashes.rb
|
63
50
|
- lib/active_support/core_ext/cgi.rb
|
64
51
|
- lib/active_support/core_ext/class
|
52
|
+
- lib/active_support/core_ext/class/attribute_accessors.rb
|
53
|
+
- lib/active_support/core_ext/class/inheritable_attributes.rb
|
54
|
+
- lib/active_support/core_ext/class/removal.rb
|
65
55
|
- lib/active_support/core_ext/class.rb
|
66
56
|
- lib/active_support/core_ext/date
|
57
|
+
- lib/active_support/core_ext/date/conversions.rb
|
67
58
|
- lib/active_support/core_ext/date.rb
|
68
59
|
- lib/active_support/core_ext/enumerable.rb
|
69
60
|
- lib/active_support/core_ext/exception.rb
|
70
61
|
- lib/active_support/core_ext/hash
|
71
|
-
- lib/active_support/core_ext/hash.rb
|
72
|
-
- lib/active_support/core_ext/integer
|
73
|
-
- lib/active_support/core_ext/integer.rb
|
74
|
-
- lib/active_support/core_ext/kernel
|
75
|
-
- lib/active_support/core_ext/kernel.rb
|
76
|
-
- lib/active_support/core_ext/load_error.rb
|
77
|
-
- lib/active_support/core_ext/logger.rb
|
78
|
-
- lib/active_support/core_ext/module
|
79
|
-
- lib/active_support/core_ext/module.rb
|
80
|
-
- lib/active_support/core_ext/name_error.rb
|
81
|
-
- lib/active_support/core_ext/numeric
|
82
|
-
- lib/active_support/core_ext/numeric.rb
|
83
|
-
- lib/active_support/core_ext/object
|
84
|
-
- lib/active_support/core_ext/object.rb
|
85
|
-
- lib/active_support/core_ext/pathname
|
86
|
-
- lib/active_support/core_ext/pathname.rb
|
87
|
-
- lib/active_support/core_ext/proc.rb
|
88
|
-
- lib/active_support/core_ext/range
|
89
|
-
- lib/active_support/core_ext/range.rb
|
90
|
-
- lib/active_support/core_ext/string
|
91
|
-
- lib/active_support/core_ext/string.rb
|
92
|
-
- lib/active_support/core_ext/symbol.rb
|
93
|
-
- lib/active_support/core_ext/time
|
94
|
-
- lib/active_support/core_ext/time.rb
|
95
|
-
- lib/active_support/core_ext/array/conversions.rb
|
96
|
-
- lib/active_support/core_ext/array/grouping.rb
|
97
|
-
- lib/active_support/core_ext/bigdecimal/formatting.rb
|
98
|
-
- lib/active_support/core_ext/cgi/escape_skipping_slashes.rb
|
99
|
-
- lib/active_support/core_ext/class/attribute_accessors.rb
|
100
|
-
- lib/active_support/core_ext/class/inheritable_attributes.rb
|
101
|
-
- lib/active_support/core_ext/class/removal.rb
|
102
|
-
- lib/active_support/core_ext/date/conversions.rb
|
103
62
|
- lib/active_support/core_ext/hash/conversions.rb
|
104
63
|
- lib/active_support/core_ext/hash/diff.rb
|
105
64
|
- lib/active_support/core_ext/hash/indifferent_access.rb
|
106
65
|
- lib/active_support/core_ext/hash/keys.rb
|
107
66
|
- lib/active_support/core_ext/hash/reverse_merge.rb
|
67
|
+
- lib/active_support/core_ext/hash.rb
|
68
|
+
- lib/active_support/core_ext/integer
|
108
69
|
- lib/active_support/core_ext/integer/even_odd.rb
|
109
70
|
- lib/active_support/core_ext/integer/inflections.rb
|
71
|
+
- lib/active_support/core_ext/integer.rb
|
72
|
+
- lib/active_support/core_ext/kernel
|
110
73
|
- lib/active_support/core_ext/kernel/agnostics.rb
|
111
74
|
- lib/active_support/core_ext/kernel/daemonizing.rb
|
112
75
|
- lib/active_support/core_ext/kernel/reporting.rb
|
113
76
|
- lib/active_support/core_ext/kernel/requires.rb
|
77
|
+
- lib/active_support/core_ext/kernel.rb
|
78
|
+
- lib/active_support/core_ext/load_error.rb
|
79
|
+
- lib/active_support/core_ext/logger.rb
|
80
|
+
- lib/active_support/core_ext/module
|
114
81
|
- lib/active_support/core_ext/module/aliasing.rb
|
115
82
|
- lib/active_support/core_ext/module/attr_internal.rb
|
116
83
|
- lib/active_support/core_ext/module/attribute_accessors.rb
|
@@ -118,40 +85,73 @@ files:
|
|
118
85
|
- lib/active_support/core_ext/module/inclusion.rb
|
119
86
|
- lib/active_support/core_ext/module/introspection.rb
|
120
87
|
- lib/active_support/core_ext/module/loading.rb
|
88
|
+
- lib/active_support/core_ext/module.rb
|
89
|
+
- lib/active_support/core_ext/name_error.rb
|
90
|
+
- lib/active_support/core_ext/numeric
|
121
91
|
- lib/active_support/core_ext/numeric/bytes.rb
|
122
92
|
- lib/active_support/core_ext/numeric/time.rb
|
93
|
+
- lib/active_support/core_ext/numeric.rb
|
94
|
+
- lib/active_support/core_ext/object
|
123
95
|
- lib/active_support/core_ext/object/extending.rb
|
124
96
|
- lib/active_support/core_ext/object/misc.rb
|
97
|
+
- lib/active_support/core_ext/object.rb
|
98
|
+
- lib/active_support/core_ext/pathname
|
125
99
|
- lib/active_support/core_ext/pathname/clean_within.rb
|
100
|
+
- lib/active_support/core_ext/pathname.rb
|
101
|
+
- lib/active_support/core_ext/proc.rb
|
102
|
+
- lib/active_support/core_ext/range
|
126
103
|
- lib/active_support/core_ext/range/conversions.rb
|
104
|
+
- lib/active_support/core_ext/range.rb
|
105
|
+
- lib/active_support/core_ext/string
|
127
106
|
- lib/active_support/core_ext/string/access.rb
|
128
107
|
- lib/active_support/core_ext/string/conversions.rb
|
129
108
|
- lib/active_support/core_ext/string/inflections.rb
|
130
109
|
- lib/active_support/core_ext/string/iterators.rb
|
131
110
|
- lib/active_support/core_ext/string/starts_ends_with.rb
|
132
111
|
- lib/active_support/core_ext/string/unicode.rb
|
112
|
+
- lib/active_support/core_ext/string.rb
|
113
|
+
- lib/active_support/core_ext/symbol.rb
|
114
|
+
- lib/active_support/core_ext/time
|
133
115
|
- lib/active_support/core_ext/time/calculations.rb
|
134
116
|
- lib/active_support/core_ext/time/conversions.rb
|
117
|
+
- lib/active_support/core_ext/time.rb
|
118
|
+
- lib/active_support/core_ext.rb
|
119
|
+
- lib/active_support/dependencies.rb
|
120
|
+
- lib/active_support/deprecation.rb
|
121
|
+
- lib/active_support/inflections.rb
|
122
|
+
- lib/active_support/inflector.rb
|
123
|
+
- lib/active_support/json
|
135
124
|
- lib/active_support/json/encoders
|
136
|
-
- lib/active_support/json/encoders.rb
|
137
125
|
- lib/active_support/json/encoders/core.rb
|
126
|
+
- lib/active_support/json/encoders.rb
|
127
|
+
- lib/active_support/json.rb
|
128
|
+
- lib/active_support/multibyte
|
138
129
|
- lib/active_support/multibyte/chars.rb
|
139
130
|
- lib/active_support/multibyte/generators
|
140
|
-
- lib/active_support/multibyte/handlers
|
141
131
|
- lib/active_support/multibyte/generators/generate_tables.rb
|
132
|
+
- lib/active_support/multibyte/handlers
|
142
133
|
- lib/active_support/multibyte/handlers/passthru_handler.rb
|
143
134
|
- lib/active_support/multibyte/handlers/utf8_handler.rb
|
144
135
|
- lib/active_support/multibyte/handlers/utf8_handler_proc.rb
|
136
|
+
- lib/active_support/multibyte.rb
|
137
|
+
- lib/active_support/option_merger.rb
|
138
|
+
- lib/active_support/ordered_options.rb
|
139
|
+
- lib/active_support/reloadable.rb
|
140
|
+
- lib/active_support/values
|
145
141
|
- lib/active_support/values/time_zone.rb
|
146
142
|
- lib/active_support/values/unicode_tables.dat
|
143
|
+
- lib/active_support/vendor
|
147
144
|
- lib/active_support/vendor/builder
|
148
|
-
- lib/active_support/vendor/builder.rb
|
149
|
-
- lib/active_support/vendor/xml_simple.rb
|
150
145
|
- lib/active_support/vendor/builder/blankslate.rb
|
151
146
|
- lib/active_support/vendor/builder/xchar.rb
|
152
147
|
- lib/active_support/vendor/builder/xmlbase.rb
|
153
148
|
- lib/active_support/vendor/builder/xmlevents.rb
|
154
149
|
- lib/active_support/vendor/builder/xmlmarkup.rb
|
150
|
+
- lib/active_support/vendor/builder.rb
|
151
|
+
- lib/active_support/vendor/xml_simple.rb
|
152
|
+
- lib/active_support/version.rb
|
153
|
+
- lib/active_support/whiny_nil.rb
|
154
|
+
- lib/active_support.rb
|
155
155
|
test_files: []
|
156
156
|
|
157
157
|
rdoc_options: []
|