Module: Persistence::Files

Included in:
Persistence
Defined in:
lib/persistence/files.rb

Instance Method Summary (collapse)

Instance Method Details

- (true, false) delete_file

Deletes the file from persistence store.

Parameters:

  • id (String)

    the ID of the file

Returns:

  • (true, false)

    True if file was deleted, otherwise false



26
# File 'lib/persistence/files.rb', line 26

delegate :delete_file, to: :file_adapter

- (Hash) file_metadata(id)

Returns metadate for given file ID.

Parameters:

  • id (BSON::ObjectId, String)

    File ID

Returns:

  • (Hash)

    File metdata



32
33
34
# File 'lib/persistence/files.rb', line 32

def (id)
  self.file_adapter.(id)
end

- (String) get_file

Retreives the file from persistence store and returns it's content.

Parameters:

  • id (String)

    the ID of the file

Returns:

  • (String)

    file content



20
# File 'lib/persistence/files.rb', line 20

delegate :get_file, to: :file_adapter

- (String) push_file

Pushes the file into persistence store and returns it's ID.

Parameters:

  • source (File)

    the file or filename

Returns:

  • (String)

    ID assigned to file



13
# File 'lib/persistence/files.rb', line 13

delegate :push_file, to: :file_adapter