Class: EeePub::OCF
- Inherits:
-
Object
- Object
- EeePub::OCF
- Defined in:
- lib/eeepub/ocf.rb
Overview
Class to create OCF
Defined Under Namespace
Classes: Container
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
-
#dir ⇒ Object
Returns the value of attribute dir.
Instance Method Summary collapse
-
#initialize(values) ⇒ OCF
constructor
A new instance of OCF.
-
#save(output_path) ⇒ Object
Save as OCF.
Constructor Details
#initialize(values) ⇒ OCF
Returns a new instance of OCF.
68 69 70 71 72 |
# File 'lib/eeepub/ocf.rb', line 68 def initialize(values) values.each do |k, v| self.send(:"#{k}=", v) end end |
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
59 60 61 |
# File 'lib/eeepub/ocf.rb', line 59 def container @container end |
#dir ⇒ Object
Returns the value of attribute dir.
59 60 61 |
# File 'lib/eeepub/ocf.rb', line 59 def dir @dir end |
Instance Method Details
#save(output_path) ⇒ Object
Save as OCF
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/eeepub/ocf.rb', line 89 def save(output_path) output_path = File.(output_path) FileUtils.chdir(dir) do File.open('mimetype', 'w') do |f| f << 'application/epub+zip' end = 'META-INF' FileUtils.mkdir_p() container.save(File.join(, 'container.xml')) %x(zip -X9 \"#{output_path}\" mimetype) %x(zip -Xr9D \"#{output_path}\" * -xi mimetype) end end |