Class: ActiveSupport::SafeBuffer

Inherits:
String show all
Defined in:
lib/active_support/core_ext/string/output_safety.rb

Instance Method Summary collapse

Methods inherited from String

#acts_like_string?, #as_json, #at, #blank?, #camelize, #classify, #constantize, #dasherize, #demodulize, #encode_json, #encoding_aware?, #exclude?, #first, #foreign_key, #from, #html_safe!, #humanize, #is_utf8?, #last, #mb_chars, #ord, #parameterize, #pluralize, #singularize, #squish, #squish!, #strip_heredoc, #tableize, #titleize, #to, #to_date, #to_datetime, #to_time, #truncate, #underscore

Instance Method Details

#+(other) ⇒ Object



87
88
89
# File 'lib/active_support/core_ext/string/output_safety.rb', line 87

def +(other)
  dup.concat(other)
end

#concat(value) ⇒ Object Also known as: <<



78
79
80
81
82
83
84
# File 'lib/active_support/core_ext/string/output_safety.rb', line 78

def concat(value)
  if value.html_safe?
    super(value)
  else
    super(ERB::Util.h(value))
  end
end

#html_safeObject



95
96
97
# File 'lib/active_support/core_ext/string/output_safety.rb', line 95

def html_safe
  self
end

#html_safe?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/active_support/core_ext/string/output_safety.rb', line 91

def html_safe?
  true
end

#safe_concatObject



76
# File 'lib/active_support/core_ext/string/output_safety.rb', line 76

alias safe_concat concat

#to_sObject



99
100
101
# File 'lib/active_support/core_ext/string/output_safety.rb', line 99

def to_s
  self
end

#to_yaml(*args) ⇒ Object



103
104
105
# File 'lib/active_support/core_ext/string/output_safety.rb', line 103

def to_yaml(*args)
  to_str.to_yaml(*args)
end