Class: BrmClient::Gateway::Mongo
- Inherits:
-
Object
- Object
- BrmClient::Gateway::Mongo
- Defined in:
- lib/brm_client/gateway/mongo.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(opts) ⇒ Mongo
constructor
A new instance of Mongo.
- #send_event(e) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Mongo
Returns a new instance of Mongo.
7 8 9 10 11 12 |
# File 'lib/brm_client/gateway/mongo.rb', line 7 def initialize opts host = opts[:host] || "localhost" port = opts[:port] || ::Mongo::Connection::DEFAULT_PORT @connection = ::Mongo::Connection.new(host, port) @collection = @connection.db(opts[:db] || opts[:application]).collection(opts[:collection] || "logs") end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'lib/brm_client/gateway/mongo.rb', line 6 def collection @collection end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/brm_client/gateway/mongo.rb', line 6 def connection @connection end |
Instance Method Details
#disconnect ⇒ Object
14 15 |
# File 'lib/brm_client/gateway/mongo.rb', line 14 def disconnect end |
#send_event(e) ⇒ Object
17 18 19 |
# File 'lib/brm_client/gateway/mongo.rb', line 17 def send_event e collection.insert(e) end |