Sha256: c167a00278dca88719d3da78a204d78a6f62d17e943810e6ea7e2e6836ad0a7e
Contents?: true
Size: 573 Bytes
Versions: 5
Compression:
Stored size: 573 Bytes
Contents
class String def is_int? self =~ /^[-+]?[0-9]*$/ end def no_html str = self.dup str.gsub!(/<\/?[^>]*>/, '') str.strip! str.gsub!(' ', '') str end def words_count frequencies = Hash.new(0) downcase.scan(/(\w+([-'.]\w+)*)/) { |word, ignore| frequencies[word] += 1 } return frequencies end def parameterize(sep = '-') value = Freeberry::Transliteration.transliterate(self) ActiveSupport::Inflector.parameterize(value, sep) end def self.randomize(length = 8) Array.new(length) { (rand(122-97) + 97).chr }.join end end
Version data entries
5 entries across 5 versions & 1 rubygems