Class: Fog::Storage::Gridfs::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog-gridfs/gridfs/storage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog-gridfs/gridfs/storage.rb', line 25

def initialize(options = {})
  host = options[:host]
  port = options[:port] || Mongo::Connection::DEFAULT_PORT
  database = options[:database]
  username = options[:username]
  password = options[:password]

  @connection = Mongo::Connection.new(host, port)
  @database = @connection.db(database)
  if username
    @database.authenticate(username, password)
  end

  @fs = Mongo::GridFileSystem.new(@database)
end

Instance Attribute Details

#fsObject (readonly)

Returns the value of attribute fs.



23
24
25
# File 'lib/fog-gridfs/gridfs/storage.rb', line 23

def fs
  @fs
end

Instance Method Details

#open(*args) ⇒ Object



41
42
43
# File 'lib/fog-gridfs/gridfs/storage.rb', line 41

def open(*args)
  @fs.open(*args)
end