Class: Mongo::Grid::File Deprecated
- Inherits:
-
Object
- Object
- Mongo::Grid::File
- Extended by:
- Forwardable
- Defined in:
- lib/mongo/grid/file.rb,
lib/mongo/grid/file/info.rb,
lib/mongo/grid/file/chunk.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.
Defined Under Namespace
Instance Attribute Summary collapse
-
#chunks ⇒ Array<Chunk>
readonly
Chunks The file chunks.
-
#info ⇒ File::Info
readonly
Info The file information.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Check equality of files.
-
#data ⇒ String
Joins chunks into a string.
-
#initialize(data, options = {}) ⇒ File
constructor
Initialize the file.
-
#inspect ⇒ String
Gets a pretty inspection of the file.
Constructor Details
Instance Attribute Details
#chunks ⇒ Array<Chunk> (readonly)
Returns chunks The file chunks.
35 36 37 |
# File 'lib/mongo/grid/file.rb', line 35 def chunks @chunks end |
#info ⇒ File::Info (readonly)
Returns info The file information.
38 39 40 |
# File 'lib/mongo/grid/file.rb', line 38 def info @info end |
Instance Method Details
#==(other) ⇒ true, false
Check equality of files.
50 51 52 53 54 |
# File 'lib/mongo/grid/file.rb', line 50 def ==(other) return false unless other.is_a?(File) chunks == other.chunks && info == other.info end |
#data ⇒ String
Joins chunks into a string.
86 87 88 |
# File 'lib/mongo/grid/file.rb', line 86 def data @data ||= Chunk.assemble(chunks) end |
#inspect ⇒ String
Gets a pretty inspection of the file.
98 99 100 |
# File 'lib/mongo/grid/file.rb', line 98 def inspect "#<Mongo::Grid::File:0x#{object_id} filename=#{filename}>" end |