Module: Epubber::Models::Concerns::HasChapters
- Included in:
- Book
- Defined in:
- lib/epubber/models/concerns/has_chapters.rb
Instance Method Summary collapse
Instance Method Details
#chapter(&block) ⇒ Object
Add chapter
10 11 12 13 14 15 |
# File 'lib/epubber/models/concerns/has_chapters.rb', line 10 def chapter(&block) chapter = Epubber::Models::Chapter.new chapter.instance_eval &block chapter.id(chapters.count + 1) chapters << chapter end |
#chapters ⇒ Object
5 6 7 |
# File 'lib/epubber/models/concerns/has_chapters.rb', line 5 def chapters @chapters ||= [] end |
#contextified_chapters ⇒ Object
17 18 19 20 21 |
# File 'lib/epubber/models/concerns/has_chapters.rb', line 17 def contextified_chapters chapters.map do |chapter| chapter.contextify end end |