blob: ceed90ce79c53329d9b995db7f761ecacc90d0a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
class Object
def html_safe?
false
end
end
class Fixnum
def html_safe?
true
end
end
class String
attr_accessor :_rails_html_safe
alias html_safe? _rails_html_safe
def html_safe!
@_rails_html_safe = true
self
end
def html_safe
dup.html_safe!
end
alias original_plus +
def +(other)
result = original_plus(other)
result._rails_html_safe = html_safe? && other.html_safe?
result
end
alias original_concat <<
alias safe_concat <<
def <<(other)
@_rails_html_safe = false unless other.html_safe?
result = original_concat(other)
end
alias concat <<
end
|