Sha256: cb163a2bce8fe27eb46c19464abec34a2fc54a19dc536f1124cd0149ec7c0d79

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 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

2 entries across 2 versions & 2 rubygems

Version Path
cschiewek-imdb-0.5.1 lib/imdb/string_extensions.rb
imdb-0.5.0 lib/imdb/string_extensions.rb