Class: Germinate::ArticleEditor

Inherits:
Object
  • Object
show all
Defined in:
lib/germinate/article_editor.rb

Overview

An Editor is responsible for selecting hunks of text from a Librarian and assembling them into a list for formatting.

Instance Method Summary collapse

Constructor Details

#initialize(librarian) ⇒ ArticleEditor

Returns a new instance of ArticleEditor.



4
5
6
# File 'lib/germinate/article_editor.rb', line 4

def initialize(librarian)
  @librarian = librarian
end

Instance Method Details

#each_hunk(&block) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/germinate/article_editor.rb', line 8

def each_hunk(&block)
  librarian.section_names.each do |section_name|
    yield librarian.section(section_name).resolve_insertions
    if librarian.has_sample?(section_name)
      yield librarian.sample(section_name).resolve_insertions 
    end
  end
end