Class: Paperdragon::File
- Inherits:
-
Object
- Object
- Paperdragon::File
- Defined in:
- lib/paperdragon/file.rb,
lib/paperdragon/file/operations.rb
Overview
A physical file with a UID.
Files are usually created via an Attachment instance. You can call processing methods on file instances. This will save the file and return the new metadata hash.
file = Paperdragon::File.new(uid)
= file.reprocess! do |job|
job.thumb!("16x16")
end
Defined Under Namespace
Modules: Delete, Process, Rename, Reprocess
Instance Attribute Summary collapse
-
#options ⇒ Object
(also: #metadata)
readonly
Returns the value of attribute options.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(uid, options = {}) ⇒ File
constructor
A new instance of File.
- #url(opts = {}) ⇒ Object
Methods included from Rename
Methods included from Reprocess
Methods included from Delete
Methods included from Process
Constructor Details
#initialize(uid, options = {}) ⇒ File
Returns a new instance of File.
14 15 16 17 18 |
# File 'lib/paperdragon/file.rb', line 14 def initialize(uid, ={}) @uid = uid @options = @data = nil # DISCUSS: do we need that here? end |
Instance Attribute Details
#options ⇒ Object (readonly) Also known as: metadata
Returns the value of attribute options.
20 21 22 |
# File 'lib/paperdragon/file.rb', line 20 def @options end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
20 21 22 |
# File 'lib/paperdragon/file.rb', line 20 def uid @uid end |
Instance Method Details
#data ⇒ Object
27 28 29 30 |
# File 'lib/paperdragon/file.rb', line 27 def data puts "........................FETCH (data): #{uid}, #{@data ? :cached : (:fetching)}" @data ||= Dragonfly.app.fetch(uid).data end |
#url(opts = {}) ⇒ Object
23 24 25 |
# File 'lib/paperdragon/file.rb', line 23 def url(opts={}) Dragonfly.app.remote_url_for(uid, opts) end |