Method: Bookmaker::Parser::Epub#sections

Defined in:
lib/bookmaker/parser/epub.rb

#sectionsObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/bookmaker/parser/epub.rb', line 4

def sections
  @sections ||= html.css("div.chapter").each_with_index.map do |chapter, index|
    OpenStruct.new({
      :index    => index,
      :filename => "section_#{index}.html",
      :filepath => tmp_dir.join("section_#{index}.html").to_s,
      :html     => Nokogiri::HTML(chapter.inner_html)
    })
  end
end