Class: Ocran::ZipWriter::Entry
- Inherits:
-
Struct
- Object
- Struct
- Ocran::ZipWriter::Entry
- Defined in:
- lib/ocran/zip_writer.rb
Overview
An archive member to add. name is the archive-relative path (with
forward slashes, no leading slash); a name ending in "/" is a
directory entry with no content. source is a path to read the
content from, data is the content itself; exactly one of them is
given for a file entry.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#name ⇒ Object
Returns the value of attribute name.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
82 83 84 |
# File 'lib/ocran/zip_writer.rb', line 82 def data @data end |
#mode ⇒ Object
Returns the value of attribute mode
82 83 84 |
# File 'lib/ocran/zip_writer.rb', line 82 def mode @mode end |
#mtime ⇒ Object
Returns the value of attribute mtime
82 83 84 |
# File 'lib/ocran/zip_writer.rb', line 82 def mtime @mtime end |
#name ⇒ Object
Returns the value of attribute name
82 83 84 |
# File 'lib/ocran/zip_writer.rb', line 82 def name @name end |
#source ⇒ Object
Returns the value of attribute source
82 83 84 |
# File 'lib/ocran/zip_writer.rb', line 82 def source @source end |
Instance Method Details
#content ⇒ Object
85 86 87 88 89 |
# File 'lib/ocran/zip_writer.rb', line 85 def content return "".b if directory? (data || File.binread(source)).b end |
#directory? ⇒ Boolean
83 |
# File 'lib/ocran/zip_writer.rb', line 83 def directory? = name.end_with?("/") |