Class: CarrierWave::Storage::Riak::File
- Inherits:
-
Object
- Object
- CarrierWave::Storage::Riak::File
- Defined in:
- lib/carrierwave/storage/riak.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #content_type ⇒ Object
- #delete ⇒ Object
-
#initialize(uploader, path) ⇒ File
constructor
A new instance of File.
- #read ⇒ Object
- #size ⇒ Object
- #url ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize(uploader, path) ⇒ File
Returns a new instance of File.
7 8 9 10 |
# File 'lib/carrierwave/storage/riak.rb', line 7 def initialize(uploader, path) @uploader = uploader @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/carrierwave/storage/riak.rb', line 5 def path @path end |
Instance Method Details
#content_type ⇒ Object
27 28 29 |
# File 'lib/carrierwave/storage/riak.rb', line 27 def content_type robject.content_type end |
#delete ⇒ Object
23 24 25 |
# File 'lib/carrierwave/storage/riak.rb', line 23 def delete robject.delete end |
#read ⇒ Object
19 20 21 |
# File 'lib/carrierwave/storage/riak.rb', line 19 def read @read ||= robject.raw_data end |
#size ⇒ Object
31 32 33 |
# File 'lib/carrierwave/storage/riak.rb', line 31 def size read.length end |
#url ⇒ Object
35 36 37 |
# File 'lib/carrierwave/storage/riak.rb', line 35 def url robject.url end |
#write(file) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/carrierwave/storage/riak.rb', line 12 def write(file) robject = bucket.new(key) robject.content_type = file.content_type robject.raw_data = file.read robject.store end |