Sha256: 66196a973637edaf86bfacc014d9ceb58777bc2b137616abdbc8714e8d222475
Contents?: true
Size: 374 Bytes
Versions: 24
Compression:
Stored size: 374 Bytes
Contents
class String # Converts string to something suitable to be used as an element id def idify 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
24 entries across 24 versions & 1 rubygems