Class: Mongo::Grid::File
- 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
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.
31 32 33 |
# File 'lib/mongo/grid/file.rb', line 31 def chunks @chunks end |
#info ⇒ File::Info (readonly)
Returns info The file information.
34 35 36 |
# File 'lib/mongo/grid/file.rb', line 34 def info @info end |
Instance Method Details
#==(other) ⇒ true, false
Check equality of files.
46 47 48 49 |
# File 'lib/mongo/grid/file.rb', line 46 def ==(other) return false unless other.is_a?(File) chunks == other.chunks && info == other.info end |
#data ⇒ String
Joins chunks into a string.
80 81 82 |
# File 'lib/mongo/grid/file.rb', line 80 def data @data ||= Chunk.assemble(chunks) end |
#inspect ⇒ String
Gets a pretty inspection of the file.
92 93 94 |
# File 'lib/mongo/grid/file.rb', line 92 def inspect "#<Mongo::Grid::File:0x#{object_id} filename=#{filename}>" end |