Class: ActiveSupport::SafeBuffer

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

Constant Summary

Constants inherited from String

String::INTERPOLATION_PATTERN, String::INTERPOLATION_PATTERN_WITH_ESCAPE

Instance Method Summary collapse

Methods inherited from String

#%, #as_json, #as_str, #blank?, #interpolate_without_ruby_19_syntax, #to_json, #to_xs

Methods included from CoreExtensions::String::Multibyte

#chars, #is_utf8?, #mb_chars

Methods included from CoreExtensions::String::Behavior

#acts_like_string?

Methods included from CoreExtensions::String::Iterators

append_features, #each_char

Methods included from CoreExtensions::String::StartsEndsWith

append_features, #ends_with?, #starts_with?

Methods included from CoreExtensions::String::Inflections

#camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, #parameterize, #pluralize, #singularize, #tableize, #titleize, #underscore

Methods included from CoreExtensions::String::Filters

#squish, #squish!

Methods included from CoreExtensions::String::Conversions

#ord, #to_date, #to_datetime, #to_time

Methods included from CoreExtensions::String::Access

#at, #first, #from, #last, #to

Instance Method Details

#+(other) ⇒ Object



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

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

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



67
68
69
70
71
72
73
# File 'lib/active_support/core_ext/string/output_safety.rb', line 67

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

#html_safeObject



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

def html_safe
  self
end

#html_safe?Boolean

Returns:

  • (Boolean)


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

def html_safe?
  true
end

#safe_concatObject



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

alias safe_concat concat

#to_sObject



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

def to_s
  self
end

#to_yaml(*args) ⇒ Object



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

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