Class: EmRiak::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/em-riak/basic.rb

Overview

A easy interface to create connections

Instance Method Summary collapse

Constructor Details

#initialize(*opts) ⇒ Connection

Returns a new instance of Connection.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/em-riak/basic.rb', line 16

def initialize(*opts)
    if opts && opts.length>0
        opts=opts.first
        methods=[:bucket, :interface, :adapter, :cluster, :async, :http_client, :vclock, :repliaction, :debug]
        opts.each{|key,opt|  EmRiak.send "#{key}=".to_sym, opt if opt && methods.index(key.to_sym)   }
    else
        EmRiak.bucket=RIAKBUCKET
    end
    EmRiak.send :handle_em_hosts, opts[:hosts] 
    EmRiak.replication={"w"=>"quorum","r"=>"quorum","n_val"=>3}  if EmRiak.replication.nil?
    
    EmRiak.debug=false if EmRiak.debug.nil?
end