Class: Foliokit::Issue
- Inherits:
-
Object
- Object
- Foliokit::Issue
- Defined in:
- lib/foliokit/issue.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#slides ⇒ Object
readonly
Returns the value of attribute slides.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(file, dir, from: nil, to: nil) ⇒ Issue
constructor
A new instance of Issue.
- #store_assets(assets_dir) ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(file, dir, from: nil, to: nil) ⇒ Issue
Returns a new instance of Issue.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/foliokit/issue.rb', line 5 def initialize(file, dir, from: nil, to: nil) @dir = dir # Convert article to folio @package = Foliokit::Package.new(file, dir, dir) @title = package.manifest.title @description = package.manifest.description @width = package.manifest.device_width @height = package.manifest.device_height @from = from @to = to @pages = [] # Add Sub-Folio Content Stacks if @package.manifest.article convert_article! else if package.subfolios(package).any? convert_folio! else convert_sub_folio! end end end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def description @description end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def dir @dir end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def height @height end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def package @package end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def pages @pages end |
#slides ⇒ Object (readonly)
Returns the value of attribute slides.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def title @title end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
3 4 5 |
# File 'lib/foliokit/issue.rb', line 3 def width @width end |
Instance Method Details
#export ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/foliokit/issue.rb', line 35 def export document = Nokogiri::HTML("<html><head><title>#{title}</title><body></body></html>") body = document.at("body") pages.each do |page| body << page.export(document) end document end |
#store_assets(assets_dir) ⇒ Object
30 31 32 33 |
# File 'lib/foliokit/issue.rb', line 30 def store_assets(assets_dir) assets_dir.delete dir.dir("assets").copy(assets_dir) end |
#to_html ⇒ Object
44 45 46 |
# File 'lib/foliokit/issue.rb', line 44 def to_html export.to_html end |