Class: Fog::Local::Storage::File
- Defined in:
- lib/fog/local/models/storage/file.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#collection, #initialize, #inspect, #reload, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11 12 13 |
# File 'lib/fog/local/models/storage/file.rb', line 11 def body @body end |
Instance Method Details
#destroy ⇒ Object
28 29 30 31 32 |
# File 'lib/fog/local/models/storage/file.rb', line 28 def destroy requires :directory, :key ::File.delete(path) true end |
#directory ⇒ Object
24 25 26 |
# File 'lib/fog/local/models/storage/file.rb', line 24 def directory @directory end |
#save(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fog/local/models/storage/file.rb', line 34 def save( = {}) requires :body, :directory, :key file = ::File.new(path, 'w') file.write(body) file.close merge_attributes( :content_length => ::File.size(path), :last_modified => ::File.mtime(path) ) true end |