Class: Epubber::Models::Chapter
- Inherits:
-
Object
- Object
- Epubber::Models::Chapter
- Includes:
- Epubber::Models::Concerns::HasHTML
- Defined in:
- lib/epubber/models/chapter.rb
Instance Method Summary collapse
- #content(text) ⇒ Object
- #contextify ⇒ Object
- #id(idx) ⇒ Object
-
#initialize ⇒ Chapter
constructor
A new instance of Chapter.
- #title(text) ⇒ Object
Methods included from Epubber::Models::Concerns::HasHTML
Constructor Details
#initialize ⇒ Chapter
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 |
#contextify ⇒ Object
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 |