Class: Low::Mongo::Local

Inherits:
Object
  • Object
show all
Includes:
Low::Mongo
Defined in:
lib/low/mongo.rb

Overview

For connecting to Mongo on localhost.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Low::Mongo

#[], #connection, #db, #grid, #reset_connection!

Constructor Details

#initialize(database, opts = {}) ⇒ Local

Specify the database upon initialization and assume that the host is localhost (unless told otherwise).



57
58
59
60
61
62
# File 'lib/low/mongo.rb', line 57

def initialize(database, opts = {})
  @database = database
  @host = opts[:host] || 'localhost'
  @username = opts[:username]
  @password = opts[:password]
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



53
54
55
# File 'lib/low/mongo.rb', line 53

def database
  @database
end

#hostObject (readonly)

Returns the value of attribute host.



53
54
55
# File 'lib/low/mongo.rb', line 53

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



53
54
55
# File 'lib/low/mongo.rb', line 53

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



53
54
55
# File 'lib/low/mongo.rb', line 53

def username
  @username
end