Class: Ungrouper
- Inherits:
-
Object
- Object
- Ungrouper
- Defined in:
- lib/notroff/grouper.rb
Instance Method Summary collapse
- #expand_group(group) ⇒ Object
-
#initialize(type) ⇒ Ungrouper
constructor
A new instance of Ungrouper.
- #process(paragraphs) ⇒ Object
Constructor Details
#initialize(type) ⇒ Ungrouper
Returns a new instance of Ungrouper.
34 35 36 |
# File 'lib/notroff/grouper.rb', line 34 def initialize(type) @type = type end |
Instance Method Details
#expand_group(group) ⇒ Object
53 54 55 |
# File 'lib/notroff/grouper.rb', line 53 def (group) group end |
#process(paragraphs) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/notroff/grouper.rb', line 38 def process( paragraphs ) processed = [] paragraphs.each do |para| if para[:type] != :group processed << para elsif para[:kid_type] != @type processed << para else kids = (para[:kids]) processed.add_all(kids) if kids end end end |