Class: Docbook::Output::IndexCollector
- Inherits:
-
Object
- Object
- Docbook::Output::IndexCollector
- Defined in:
- lib/docbook/output/index_generator.rb
Instance Method Summary collapse
- #by_type ⇒ Object
- #collect ⇒ Object
-
#initialize(document) ⇒ IndexCollector
constructor
A new instance of IndexCollector.
Constructor Details
#initialize(document) ⇒ IndexCollector
Returns a new instance of IndexCollector.
6 7 8 9 |
# File 'lib/docbook/output/index_generator.rb', line 6 def initialize(document) @document = document @index_terms = [] end |
Instance Method Details
#by_type ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/docbook/output/index_generator.rb', line 17 def by_type result = {} @index_terms.each do |term| type = term[:type] || "default" result[type] ||= [] result[type] << term end result end |
#collect ⇒ Object
11 12 13 14 15 |
# File 'lib/docbook/output/index_generator.rb', line 11 def collect @index_terms = [] traverse(@document, {}) @index_terms end |