Class: Mongo::Grid::File Deprecated
- Inherits:
-
Object
- Object
- Mongo::Grid::File
- Extended by:
- Forwardable
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/grid/file.rb,
build/ruby-driver-v2.19/lib/mongo/grid/file/info.rb,
build/ruby-driver-v2.19/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.
37 38 39 |
# File 'build/ruby-driver-v2.19/lib/mongo/grid/file.rb', line 37 def chunks @chunks end |
#info ⇒ File::Info (readonly)
Returns info The file information.
40 41 42 |
# File 'build/ruby-driver-v2.19/lib/mongo/grid/file.rb', line 40 def info @info end |
Instance Method Details
#==(other) ⇒ true, false
Check equality of files.
52 53 54 55 |
# File 'build/ruby-driver-v2.19/lib/mongo/grid/file.rb', line 52 def ==(other) return false unless other.is_a?(File) chunks == other.chunks && info == other.info end |
#data ⇒ String
Joins chunks into a string.
87 88 89 |
# File 'build/ruby-driver-v2.19/lib/mongo/grid/file.rb', line 87 def data @data ||= Chunk.assemble(chunks) end |
#inspect ⇒ String
Gets a pretty inspection of the file.
99 100 101 |
# File 'build/ruby-driver-v2.19/lib/mongo/grid/file.rb', line 99 def inspect "#<Mongo::Grid::File:0x#{object_id} filename=#{filename}>" end |