Class: CarrierWave::Storage::NosFile
- Inherits:
-
CarrierWave::SanitizedFile
- Object
- CarrierWave::SanitizedFile
- CarrierWave::Storage::NosFile
- Defined in:
- lib/carrierwave/storage/nos_file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(uploader, base, path) ⇒ NosFile
constructor
A new instance of NosFile.
- #read ⇒ Object
- #store(file) ⇒ Object
- #url(_opts = {}) ⇒ Object
Constructor Details
#initialize(uploader, base, path) ⇒ NosFile
Returns a new instance of NosFile.
6 7 8 9 10 |
# File 'lib/carrierwave/storage/nos_file.rb', line 6 def initialize(uploader, base, path) @uploader = uploader @base = base @path = URI.encode(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/carrierwave/storage/nos_file.rb', line 4 def path @path end |
Instance Method Details
#read ⇒ Object
12 13 14 15 16 |
# File 'lib/carrierwave/storage/nos_file.rb', line 12 def read object = bucket.get(@path) @headers = object.headers object end |
#store(file) ⇒ Object
18 19 20 |
# File 'lib/carrierwave/storage/nos_file.rb', line 18 def store(file) bucket.put(@path, file) end |
#url(_opts = {}) ⇒ Object
22 23 24 |
# File 'lib/carrierwave/storage/nos_file.rb', line 22 def url(_opts = {}) bucket.path_to_url(@path) end |