Class: DirectWave::Uploader::Base
- Inherits:
-
Object
- Object
- DirectWave::Uploader::Base
- Includes:
- Accreditation, Configuration, Connection, Paths, Versions
- Defined in:
- lib/directwave/uploader/uploader.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#mounted_as ⇒ Object
readonly
Returns the value of attribute mounted_as.
Instance Method Summary collapse
- #destroy ⇒ Object
- #global_process ⇒ Object
-
#initialize(model = nil, mounted_as = nil) ⇒ Base
constructor
A new instance of Base.
- #save ⇒ Object
Methods included from Versions
Methods included from Paths
#default_url, #filename, #has_store_key?, #key, #original_filename, #store_key, #store_key=, #url
Methods included from Accreditation
#s3_acl, #s3_policy, #s3_signature
Constructor Details
#initialize(model = nil, mounted_as = nil) ⇒ Base
Returns a new instance of Base.
13 14 15 16 |
# File 'lib/directwave/uploader/uploader.rb', line 13 def initialize(model=nil, mounted_as=nil) @model = model @mounted_as = mounted_as end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
11 12 13 |
# File 'lib/directwave/uploader/uploader.rb', line 11 def model @model end |
#mounted_as ⇒ Object (readonly)
Returns the value of attribute mounted_as.
11 12 13 |
# File 'lib/directwave/uploader/uploader.rb', line 11 def mounted_as @mounted_as end |
Instance Method Details
#destroy ⇒ Object
30 31 32 |
# File 'lib/directwave/uploader/uploader.rb', line 30 def destroy versions.each { |name, version| version.delete } end |
#global_process ⇒ Object
34 |
# File 'lib/directwave/uploader/uploader.rb', line 34 def global_process; end |
#save ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/directwave/uploader/uploader.rb', line 18 def save if has_store_key? # at first remove previous files versions.each { |name, version| version.delete } unless model[mounted_as].blank? # at second process new files model[mounted_as] = filename versions.each { |name, version| version.process } global_process end end |