| Module | ActiveSupport::CoreExtensions::String::OutputSafety |
| In: |
vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb
|
# File vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb, line 5
5: def self.included(base)
6: base.class_eval do
7: alias_method :add_without_safety, :+
8: alias_method :+, :add_with_safety
9: alias_method_chain :concat, :safety
10: undef_method :<<
11: alias_method :<<, :concat_with_safety
12: end
13: end
# File vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb, line 24
24: def add_with_safety(other)
25: result = add_without_safety(other)
26: if html_safe? && also_html_safe?(other)
27: result.html_safe!
28: else
29: result
30: end
31: end
# File vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb, line 33
33: def concat_with_safety(other_or_fixnum)
34: result = concat_without_safety(other_or_fixnum)
35: unless html_safe? && also_html_safe?(other_or_fixnum)
36: @_rails_html_safe = false
37: end
38: result
39: end
# File vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb, line 19
19: def html_safe!
20: @_rails_html_safe = true
21: self
22: end