class Epubber::Models::Book
Public Class Methods
new()
click to toggle source
# File lib/epubber/models/book.rb, line 16 def initialize @title = not_specified @author = not_specified @publisher = not_specified @language = 'en' @url = not_specified # LIST / OF / SUBJECTS => https://www.bisg.org/complete-bisac-subject-headings-2014-edition @subjects = 'NON000000 NON-CLASSIFIABLE' @isbn = nil end
Public Instance Methods
contextify()
click to toggle source
Return a hash which can be used as a template’s context
# File lib/epubber/models/book.rb, line 57 def contextify context = { # Attributes "title" => @title, "author" => @author, "publisher" => @publisher, "language" => @language, "url" => @url, "subjects" => @subjects, "uuid" => ::SecureRandom.uuid, "isbn" => @isbn } # Related models context["chapters"] = contextified_chapters context["introduction"] = contextified_introduction context["endnotes"] = contextified_endnotes context["cover"] = contextified_cover context end
isbn(isbn)
click to toggle source
# File lib/epubber/models/book.rb, line 52 def isbn(isbn) @isbn = isbn end
language(lang)
click to toggle source
# File lib/epubber/models/book.rb, line 40 def language(lang) @language = lang end
publisher(text)
click to toggle source
# File lib/epubber/models/book.rb, line 36 def publisher(text) @publisher = text end
subjects(subjects)
click to toggle source
# File lib/epubber/models/book.rb, line 48 def subjects(subjects) @subjects = subjects end
title(text = nil)
click to toggle source
# File lib/epubber/models/book.rb, line 27 def title(text = nil) return @title if text.nil? @title = text end
url(url)
click to toggle source
# File lib/epubber/models/book.rb, line 44 def url(url) @url = url end
Protected Instance Methods
not_specified()
click to toggle source
# File lib/epubber/models/book.rb, line 81 def not_specified 'Not specified' end