activesupport 3.0.12.rc1 → 3.0.12
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.
@@ -85,23 +85,41 @@ module ActiveSupport #:nodoc:
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def [](*args)
|
89
|
+
return super if args.size < 2
|
90
|
+
|
91
|
+
if html_safe?
|
92
|
+
new_safe_buffer = super
|
93
|
+
new_safe_buffer.instance_eval { @html_safe = true }
|
94
|
+
new_safe_buffer
|
95
|
+
else
|
96
|
+
to_str[*args]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
88
100
|
def safe_concat(value)
|
89
|
-
raise SafeConcatError
|
101
|
+
raise SafeConcatError unless html_safe?
|
90
102
|
original_concat(value)
|
91
103
|
end
|
92
104
|
|
93
105
|
def initialize(*)
|
94
|
-
@
|
106
|
+
@html_safe = true
|
95
107
|
super
|
96
108
|
end
|
97
109
|
|
98
110
|
def initialize_copy(other)
|
99
111
|
super
|
100
|
-
@
|
112
|
+
@html_safe = other.html_safe?
|
113
|
+
end
|
114
|
+
|
115
|
+
def clone_empty
|
116
|
+
new_safe_buffer = self[0, 0]
|
117
|
+
new_safe_buffer.instance_variable_set(:@dirty, @dirty)
|
118
|
+
new_safe_buffer
|
101
119
|
end
|
102
120
|
|
103
121
|
def concat(value)
|
104
|
-
if
|
122
|
+
if !html_safe? || value.html_safe?
|
105
123
|
super(value)
|
106
124
|
else
|
107
125
|
super(ERB::Util.h(value))
|
@@ -114,7 +132,7 @@ module ActiveSupport #:nodoc:
|
|
114
132
|
end
|
115
133
|
|
116
134
|
def html_safe?
|
117
|
-
|
135
|
+
defined?(@html_safe) && @html_safe
|
118
136
|
end
|
119
137
|
|
120
138
|
def to_s
|
@@ -132,23 +150,17 @@ module ActiveSupport #:nodoc:
|
|
132
150
|
for unsafe_method in UNSAFE_STRING_METHODS
|
133
151
|
if 'String'.respond_to?(unsafe_method)
|
134
152
|
class_eval <<-EOT, __FILE__, __LINE__ + 1
|
135
|
-
def #{unsafe_method}(*args)
|
136
|
-
|
137
|
-
end
|
138
|
-
|
139
|
-
def #{unsafe_method}!(*args)
|
140
|
-
@
|
141
|
-
super
|
142
|
-
end
|
153
|
+
def #{unsafe_method}(*args, &block) # def capitalize(*args, &block)
|
154
|
+
to_str.#{unsafe_method}(*args, &block) # to_str.capitalize(*args, &block)
|
155
|
+
end # end
|
156
|
+
|
157
|
+
def #{unsafe_method}!(*args) # def capitalize!(*args)
|
158
|
+
@html_safe = false # @html_safe = false
|
159
|
+
super # super
|
160
|
+
end # end
|
143
161
|
EOT
|
144
162
|
end
|
145
163
|
end
|
146
|
-
|
147
|
-
protected
|
148
|
-
|
149
|
-
def dirty?
|
150
|
-
@dirty
|
151
|
-
end
|
152
164
|
end
|
153
165
|
end
|
154
166
|
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 12
|
10
|
-
|
11
|
-
- 1
|
12
|
-
version: 3.0.12.rc1
|
10
|
+
version: 3.0.12
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- David Heinemeier Hansson
|
@@ -17,7 +15,7 @@ autorequire:
|
|
17
15
|
bindir: bin
|
18
16
|
cert_chain: []
|
19
17
|
|
20
|
-
date: 2012-
|
18
|
+
date: 2012-03-01 00:00:00 Z
|
21
19
|
dependencies: []
|
22
20
|
|
23
21
|
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.
|
@@ -260,14 +258,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
258
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
259
|
none: false
|
262
260
|
requirements:
|
263
|
-
- - "
|
261
|
+
- - ">="
|
264
262
|
- !ruby/object:Gem::Version
|
265
|
-
hash:
|
263
|
+
hash: 3
|
266
264
|
segments:
|
267
|
-
-
|
268
|
-
|
269
|
-
- 1
|
270
|
-
version: 1.3.1
|
265
|
+
- 0
|
266
|
+
version: "0"
|
271
267
|
requirements: []
|
272
268
|
|
273
269
|
rubyforge_project: activesupport
|