Sha256: 4adc5065adfe68dd3906908f8c202067d023dc2e52ebc4e73215a18dfeea2113
Contents?: true
Size: 605 Bytes
Versions: 8
Compression:
Stored size: 605 Bytes
Contents
module SDoc::Helpers def each_letter_group(methods, &block) group = {:name => '', :methods => []} methods.sort{ |a, b| a.name <=> b.name }.each do |method| gname = group_name method.name if gname != group[:name] yield group unless group[:methods].size == 0 group = { :name => gname, :methods => [] } end group[:methods].push(method) end yield group unless group[:methods].size == 0 end protected def group_name name if match = name.match(/^([a-z])/i) match[1].upcase else '#' end end end
Version data entries
8 entries across 8 versions & 2 rubygems