Class: Rpub::Epub::Cover
Instance Attribute Summary collapse
-
#book ⇒ Object
readonly
Returns the value of attribute book.
Attributes inherited from XmlFile
Instance Method Summary collapse
-
#initialize(book) ⇒ Cover
constructor
A new instance of Cover.
- #render ⇒ Object
Methods inherited from XmlFile
Constructor Details
#initialize(book) ⇒ Cover
Returns a new instance of Cover.
6 7 8 9 |
# File 'lib/rpub/epub/cover.rb', line 6 def initialize(book) @book = book super() end |
Instance Attribute Details
#book ⇒ Object (readonly)
Returns the value of attribute book.
4 5 6 |
# File 'lib/rpub/epub/cover.rb', line 4 def book @book end |
Instance Method Details
#render ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rpub/epub/cover.rb', line 11 def render xml.declare! :DOCTYPE, :html, :PUBLIC, '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' xml.html :xmlns => 'http://www.w3.org/1999/xhtml' do xml.head do xml.title 'Cover' xml.style 'img { max-width: 100%; }', :type => 'text/css' end xml.body do xml.div :id => 'cover-image' do xml.img :src => book.cover_image, :alt => book.title end end end end |