Class: Mongoo::GridFs::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoo/grid_fs/files.rb

Instance Method Summary collapse

Constructor Details

#initialize(container_hash, db_lambda) ⇒ Files

Returns a new instance of Files.



5
6
7
8
# File 'lib/mongoo/grid_fs/files.rb', line 5

def initialize(container_hash, db_lambda)
  @db_lambda = db_lambda
  @container_hash = container_hash
end

Instance Method Details

#delete(*args) ⇒ Object



25
26
27
28
29
30
# File 'lib/mongoo/grid_fs/files.rb', line 25

def delete(*args)
  key = args.shift
  if @container_hash[key]
    Mongoo::GridFs::File.new(@container_hash[key], @db_lambda).delete(*args)
  end
end

#get(*args) ⇒ Object



10
11
12
13
14
15
# File 'lib/mongoo/grid_fs/files.rb', line 10

def get(*args)
  key = args.shift
  if @container_hash[key]
    Mongoo::GridFs::File.new(@container_hash[key], @db_lambda).get(*args)
  end
end

#put(*args) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/mongoo/grid_fs/files.rb', line 17

def put(*args)
  key = args.shift
  unless @container_hash[key]
    @container_hash[key] = {}
  end
  Mongoo::GridFs::File.new(@container_hash[key], @db_lambda).put(*args)
end