Class: Epubber::Models::Chapter

Inherits:
Model
  • Object
show all
Defined in:
lib/epubber/models/chapter.rb

Instance Method Summary collapse

Methods inherited from Model

#clean_html

Constructor Details

#initializeChapter

Returns a new instance of Chapter.



6
7
8
9
10
# File 'lib/epubber/models/chapter.rb', line 6

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

Instance Method Details

#content(text) ⇒ Object



20
21
22
# File 'lib/epubber/models/chapter.rb', line 20

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

#contextifyObject



24
25
26
# File 'lib/epubber/models/chapter.rb', line 24

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

#id(idx) ⇒ Object



12
13
14
# File 'lib/epubber/models/chapter.rb', line 12

def id(idx)
  @id = idx
end

#title(text) ⇒ Object



16
17
18
# File 'lib/epubber/models/chapter.rb', line 16

def title(text)
  @title = text
end