Class: Stash::Wrapper::StashFile
- Inherits:
-
Object
- Object
- Stash::Wrapper::StashFile
- Includes:
- XML::Mapping
- Defined in:
- lib/stash/wrapper/stash_file.rb
Overview
Mapping for <st:file>.
Instance Method Summary collapse
-
#initialize(pathname:, size_bytes:, mime_type:) ⇒ StashFile
constructor
Creates a new StashFile object.
-
#mime_type=(value) ⇒ Object
Sets the MIME type, converting from a string if necessary.
-
#size_bytes ⇒ Integer
Gets the size in bytes, extracting it from the Size.
-
#size_bytes=(bytes) ⇒ Object
Sets the size in bytes, expanding it to a Size object.
Constructor Details
#initialize(pathname:, size_bytes:, mime_type:) ⇒ StashFile
Creates a new Stash::Wrapper::StashFile object
22 23 24 25 26 |
# File 'lib/stash/wrapper/stash_file.rb', line 22 def initialize(pathname:, size_bytes:, mime_type:) self.pathname = pathname self.size_bytes = size_bytes self.mime_type = mime_type end |
Instance Method Details
#mime_type=(value) ⇒ Object
Sets the MIME type, converting from a string if necessary
31 32 33 |
# File 'lib/stash/wrapper/stash_file.rb', line 31 def mime_type=(value) @mime_type = to_mime_type(value) end |
#size_bytes ⇒ Integer
Gets the size in bytes, extracting it from the Stash::Wrapper::Size
43 44 45 |
# File 'lib/stash/wrapper/stash_file.rb', line 43 def size_bytes size.size end |
#size_bytes=(bytes) ⇒ Object
Sets the size in bytes, expanding it to a Stash::Wrapper::Size object
37 38 39 |
# File 'lib/stash/wrapper/stash_file.rb', line 37 def size_bytes=(bytes) self.size = Size.new(bytes: bytes) end |