Class: Fog::Local::File
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#_dump, _load, aliases, attribute, attributes, #attributes, #collection, identity, #identity, #identity=, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
10 11 12 |
# File 'lib/fog/local/models/file.rb', line 10 def body @body end |
Instance Method Details
#destroy ⇒ Object
27 28 29 30 31 |
# File 'lib/fog/local/models/file.rb', line 27 def destroy requires :directory, :key ::File.delete(path) true end |
#directory ⇒ Object
23 24 25 |
# File 'lib/fog/local/models/file.rb', line 23 def directory @directory end |
#save(options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fog/local/models/file.rb', line 33 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 |