Class: String
- Includes:
- ActiveSupport::CoreExtensions::String::Access, ActiveSupport::CoreExtensions::String::Conversions, ActiveSupport::CoreExtensions::String::Inflections, ActiveSupport::CoreExtensions::String::Iterators, ActiveSupport::CoreExtensions::String::StartsEndsWith, ActiveSupport::CoreExtensions::String::Unicode
- Defined in:
- lib/active_support/core_ext/blank.rb,
lib/active_support/core_ext/string.rb,
lib/active_support/vendor/builder/xchar.rb
Overview
Enhance the String class with a XML escaped character version of to_s.
Direct Known Subclasses
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#to_xs ⇒ Object
XML escaped version of to_s.
Methods included from ActiveSupport::CoreExtensions::String::Unicode
Methods included from ActiveSupport::CoreExtensions::String::Iterators
Methods included from ActiveSupport::CoreExtensions::String::StartsEndsWith
Methods included from ActiveSupport::CoreExtensions::String::Inflections
#camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, #pluralize, #singularize, #tableize, #titleize, #underscore
Methods included from ActiveSupport::CoreExtensions::String::Conversions
Methods included from ActiveSupport::CoreExtensions::String::Access
#at, #first, #from, #last, #to
Instance Method Details
#blank? ⇒ Boolean
41 42 43 |
# File 'lib/active_support/core_ext/blank.rb', line 41 def blank? empty? || strip.empty? end |
#to_xs ⇒ Object
XML escaped version of to_s
107 108 109 110 111 |
# File 'lib/active_support/vendor/builder/xchar.rb', line 107 def to_xs unpack('U*').map {|n| n.xchr}.join # ASCII, UTF-8 rescue unpack('C*').map {|n| n.xchr}.join # ISO-8859-1, WIN-1252 end |