Class: ActiveSupport::SafeBuffer

Inherits:
String show all
Defined in:
activesupport/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

- (Object) +(other)



79
80
81
# File 'activesupport/lib/active_support/core_ext/string/output_safety.rb', line 79

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

- (Object) concat(value) Also known as: safe_concat, <<



70
71
72
73
74
75
76
# File 'activesupport/lib/active_support/core_ext/string/output_safety.rb', line 70

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

- (Object) html_safe



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

def html_safe
  self
end

- (Boolean) html_safe?

Returns:

  • (Boolean)


83
84
85
# File 'activesupport/lib/active_support/core_ext/string/output_safety.rb', line 83

def html_safe?
  true
end

- (Object) to_s



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

def to_s
  self
end

- (Object) to_yaml(*args)



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

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