blob: 3e6ab0ebd2840b2495e752f7df743936573a07b8 (
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
|
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
|