Sha256: b161643e64bbb69ac0f07c5761320421b2adfeb33577d443688f58894365ee18

Contents?: true

Size: 361 Bytes

Versions: 7

Compression:

Stored size: 361 Bytes

Contents

require 'cgi'

module StringExtensions
  # Unescape HTML
  def unescape_html
    CGI.unescapeHTML(encode('UTF-8'))
  end

  # Strip tags
  def strip_tags
    gsub(/<\/?[^>]*>/, '')
  end

  # Strips out whitespace then tests if the string is empty.
  def blank?
    strip.empty?
  end unless method_defined?(:blank?)
end

String.send :include, StringExtensions

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gares-3.0.0 lib/string_extensions.rb
gares-2.1.1 lib/string_extensions.rb
gares-2.1.0 lib/string_extensions.rb
gares-2.0.1 lib/string_extensions.rb
gares-2.0.0 lib/string_extensions.rb
gares-2.0.0.pre.2 lib/string_extensions.rb
gares-2.0.0.pre.1 lib/string_extensions.rb