Class: NetSystem::MongoClient
- Inherits:
-
Client
- Object
- Liza::Unit
- Liza::Controller
- Client
- NetSystem::MongoClient
- Defined in:
- lib/net_system/sub/database/clients/mongo_client.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
Methods inherited from Liza::Controller
color, inherited, on_connected
Methods inherited from Liza::Unit
const_missing, division, part, system, #system, test_class
Constructor Details
#initialize(hash = {}) ⇒ MongoClient
5 6 7 8 9 10 11 12 13 |
# File 'lib/net_system/sub/database/clients/mongo_client.rb', line 5 def initialize hash={} require "mongo" t = Time.now hash = NetBox[:client].get(:mongo_hash) if hash.empty? uri = "mongodb://#{hash[:host]}:#{hash[:port]}/#{hash[:database]}" @conn = Mongo::Client.new(uri) ensure log "#{t.diff}s | Connecting to #{hash}" end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
15 16 17 |
# File 'lib/net_system/sub/database/clients/mongo_client.rb', line 15 def conn @conn end |
Instance Method Details
#call(args) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/net_system/sub/database/clients/mongo_client.rb', line 17 def call args t = Time.now raise NotImplementedError ensure log "#{t.diff}s | #{cmd_name} | #{args}" end |