Revision c496d1ee
Added by Marc Dequènes almost 14 years ago
- ID c496d1eef8446b745751c07b695a097031011bf8
lib/cyborghood/base/lang_additions.rb | ||
---|---|---|
require 'active_support'
|
||
require 'ostruct'
|
||
|
||
# backported fix: https://github.com/rails/rails/commit/c401102a2702f9b945803e66d3a25b77d882ee13
|
||
class String
|
||
def html_safe?
|
||
defined?(@_rails_html_safe)
|
||
end
|
||
|
||
def concat_with_safety(other_or_fixnum)
|
||
result = concat_without_safety(other_or_fixnum)
|
||
unless html_safe? && also_html_safe?(other_or_fixnum)
|
||
remove_instance_variable(:@_rails_html_safe) if defined?(@_rails_html_safe)
|
||
end
|
||
result
|
||
end
|
||
|
||
undef_method :<<
|
||
alias_method :<<, :concat_with_safety
|
||
end
|
||
|
||
class Hash
|
||
def to_ostruct
|
||
data = self.dup
|
Also available in: Unified diff
[monkeypatch] backported a patch to solve @_rails_html_safe breaking YAML parsing