Module: SDoc::Helpers

Included in:
RDoc::Generator::SHtml
Defined in:
lib/sdoc/helpers.rb

Instance Method Summary collapse

Instance Method Details

#each_letter_group(methods) {|group| ... } ⇒ Object

Yields:

  • (group)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sdoc/helpers.rb', line 2

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