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

#%, #add_with_safety, #as_json, #as_str, #blank?, #concat_with_safety, #html_safe!, #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



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

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

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



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

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

#html_safeObject



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

def html_safe
  self
end

#html_safe?Boolean

Returns:

  • (Boolean)


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

def html_safe?
  true
end

#safe_concatObject



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

alias safe_concat concat

#to_sObject



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

def to_s
  self
end

#to_yaml(*args) ⇒ Object



108
109
110
# File 'lib/active_support/core_ext/string/output_safety.rb', line 108

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