Class: Epubber::Models::Book
Instance Method Summary
collapse
#contextified_endnotes, #endnotes
#contextified_introduction, #introduction
#chapter, #chapters, #contextified_chapters
Methods inherited from Model
#clean_html
Constructor Details
#initialize ⇒ Book
Returns a new instance of Book.
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/epubber/models/book.rb', line 15
def initialize
@title = not_specified
@author = not_specified
@publisher = not_specified
@language = 'en'
@url = not_specified
@subjects = 'NON000000 NON-CLASSIFIABLE'
@isbn = nil
end
|
Instance Method Details
#author(text) ⇒ Object
31
32
33
|
# File 'lib/epubber/models/book.rb', line 31
def author(text)
@author = text
end
|
#contextify ⇒ Object
Return a hash which can be used as a template’s context
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/epubber/models/book.rb', line 56
def contextify
context = {
"title" => @title,
"author" => @author,
"publisher" => @publisher,
"language" => @language,
"url" => @url,
"subjects" => @subjects,
"uuid" => ::SecureRandom.uuid,
"isbn" => @isbn
}
context["chapters"] = contextified_chapters
context["introduction"] = contextified_introduction
context["endnotes"] = contextified_endnotes
return context
end
|
#isbn(isbn) ⇒ Object
51
52
53
|
# File 'lib/epubber/models/book.rb', line 51
def isbn(isbn)
@isbn = isbn
end
|
#language(lang) ⇒ Object
39
40
41
|
# File 'lib/epubber/models/book.rb', line 39
def language(lang)
@language = lang
end
|
#publisher(text) ⇒ Object
35
36
37
|
# File 'lib/epubber/models/book.rb', line 35
def publisher(text)
@publisher = text
end
|
#subjects(subjects) ⇒ Object
47
48
49
|
# File 'lib/epubber/models/book.rb', line 47
def subjects(subjects)
@subjects = subjects
end
|
#title(text = nil) ⇒ Object
26
27
28
29
|
# File 'lib/epubber/models/book.rb', line 26
def title(text = nil)
return @title if text.nil?
@title = text
end
|
#url(url) ⇒ Object
43
44
45
|
# File 'lib/epubber/models/book.rb', line 43
def url(url)
@url = url
end
|