Class: Mongo::Grid::File Deprecated
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Inherits: | Object |
Defined in: | lib/mongo/grid/file.rb, lib/mongo/grid/file/chunk.rb, lib/mongo/grid/file/info.rb |
Overview
Deprecated.
Please use the ‘stream’ API on a FSBucket
instead. Will be removed in driver version 3.0.
A representation of a file in the database.
Class Method Summary
-
.new(data, options = {}) ⇒ File
constructor
Initialize the file.
Instance Attribute Summary
- #chunks ⇒ Array<Chunk> readonly
- #info ⇒ File::Info readonly
Instance Method Summary
-
#==(other) ⇒ true, false
Check equality of files.
-
#data ⇒ String
Joins chunks into a string.
-
#inspect ⇒ String
Gets a pretty inspection of the file.
- #initialize_chunks!(value) ⇒ Array<Grid::File::Chunk> private
Constructor Details
.new(data, options = {}) ⇒ File
Initialize the file.
Instance Attribute Details
#chunks ⇒ Array
<Chunk> (readonly)
# File 'lib/mongo/grid/file.rb', line 37
attr_reader :chunks
#info ⇒ File::Info (readonly)
# File 'lib/mongo/grid/file.rb', line 40
attr_reader :info
Instance Method Details
#==(other) ⇒ true
, false
Check equality of files.
#data ⇒ String
Joins chunks into a string.
#initialize_chunks!(value) ⇒ Array
<Grid::File::Chunk> (private)
Note:
If we have provided an array of BSON::Documents to initialize with, we have an array of chunk documents and need to create the chunk objects and assemble the data. If we have an IO object, then it’s the original file data and we must split it into chunks and set the original data itself.
#inspect ⇒ String
Gets a pretty inspection of the file.
# File 'lib/mongo/grid/file.rb', line 99
def inspect "#<Mongo::Grid::File:0x#{object_id} filename=#{filename}>" end