Class: Epubber::Models::Chapter

Inherits:
Object
  • Object
show all
Includes:
Epubber::Models::Concerns::HasHTML
Defined in:
lib/epubber/models/chapter.rb

Instance Method Summary collapse

Methods included from Epubber::Models::Concerns::HasHTML

#clean_html

Constructor Details

#initializeChapter

Returns a new instance of Chapter.



8
9
10
11
12
# File 'lib/epubber/models/chapter.rb', line 8

def initialize
  @id = 0
  @title = 'Not specified'
  @content = '<p>Not specified</p>'
end

Instance Method Details

#content(text) ⇒ Object



22
23
24
# File 'lib/epubber/models/chapter.rb', line 22

def content(text)
  @content = clean_html(text)
end

#contextifyObject



26
27
28
# File 'lib/epubber/models/chapter.rb', line 26

def contextify
  { 'id' => @id, 'title' => @title, 'content' => @content }
end

#id(idx) ⇒ Object



14
15
16
# File 'lib/epubber/models/chapter.rb', line 14

def id(idx)
  @id = idx
end

#title(text) ⇒ Object



18
19
20
# File 'lib/epubber/models/chapter.rb', line 18

def title(text)
  @title = text
end