Sha256: f78036568b9f46d1c2dfcda57ab33b8d3e616a37eb9883795182d951148f3c8d

Contents?: true

Size: 478 Bytes

Versions: 3

Compression:

Stored size: 478 Bytes

Contents

require 'cgi'
require 'iconv'
 
module Imdb #:nordoc:
  module StringExtensions
  
    # Unescape HTML
    def imdb_unescape_html
      Iconv.conv("UTF-8", 'ISO-8859-1', CGI::unescapeHTML(self))
    end
  
    # Strip tags
    def imdb_strip_tags
      gsub(/<\/?[^>]*>/, "")
    end

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

String.send :include, Imdb::StringExtensions

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
imdb-0.6.1 lib/imdb/string_extensions.rb
imdb-0.6.0 lib/imdb/string_extensions.rb
imdb-0.5.1 lib/imdb/string_extensions.rb