class Nightwatch::Mongo
Public Class Methods
new(opts = {})
click to toggle source
TODO: Allow users to specify client (e.g. Nightwatch::Mongo.new
(client: mongo_client)) TODO: Raise error if one of :host/:port or :client is not specified
# File lib/nightwatch/mongo.rb, line 7 def initialize(opts = {}) @host = opts[:host] || '127.0.0.1' @port = opts[:port] || 27017 @database = opts[:database] || 'nightwatch' end
Public Instance Methods
log(record)
click to toggle source
# File lib/nightwatch/mongo.rb, line 13 def log(record) collection.insert(record) end
Private Instance Methods
collection()
click to toggle source
# File lib/nightwatch/mongo.rb, line 19 def collection @collection ||= begin mongo = ::Mongo::MongoClient.new(@host, @port) mongo[@database]['exceptions'] end end