Sha256: 2db52483a39822d88207c9af8ca37fb38dc63c3fc23ce2eac54d41f46a0d15f6

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

$:.unshift(File.dirname(__FILE__)) unless
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require 'mongo'
require 'set'
require 'uuidtools'

require 'magent/utils'
require 'magent/generic_channel'
require 'magent/channel'
require 'magent/push'
require 'magent/actor'
require 'magent/processor'

module Magent
  VERSION = '0.4.1'

  @@db_name = 'magent'
  @@host = 'localhost'
  @@port = '27017'
  @@username = ''
  @@password = ''

  def self.host(host,port)
    @@host = host
    @@port = port
  end

  def self.auth(username,password)
    @@username = username
    @@password = password
  end

  def self.db_name(db_name)
    @@db_name = db_name
  end

  def self.connection
    return @@connection if defined? @@connection  
    @@connection = Mongo::Connection.new(@@host, @@port, :auto_reconnect => true)
    @@connection.add_auth(@@db_name, @@username, @@password) if @@username!='' && @@password!=''
    return @@connection
  end

  def self.connection=(new_connection)
    @@connection = new_connection
  end

  def self.database=(name)
    @@database = Magent.connection.db(name)
  end

  def self.database
    @@database ||= Magent.connection.db(@@db_name)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thirtysixthspan-magent-0.4.1 lib/magent.rb