Sha256: 39472ae65035cbbe9d71cabdf12ed5c760cd87282d06149753bc88abda743cba
Contents?: true
Size: 378 Bytes
Versions: 14
Compression:
Stored size: 378 Bytes
Contents
class String # Converts string to something suitable to be used as an element id def slugify self.strip.gsub(/\W|_/, '-').gsub(/\s|^_*|_*$/, '').squeeze('-') end end module Enumerable # Like a normal collect, only with index def collect_with_index result = [] self.each_with_index do |elt, idx| result << yield(elt, idx) end result end end
Version data entries
14 entries across 14 versions & 1 rubygems