Class: Sensu::Redis::Client
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Sensu::Redis::Client
- Includes:
- EM::Deferrable, Commands, Connection, Parser, Processor
- Defined in:
- lib/sensu/redis.rb
Class Method Summary collapse
Methods included from Connection
#after_reconnect, #before_reconnect, #close, #connected?, #connection_completed, #error, #initialize, #on_error, #reconnect!, #unbind, #validate_connection!
Methods included from Commands
#auth_and_select_db, #create_command_methods!, #get_size, #send_command, #subscribe, #unsubscribe
Methods included from Processor
#begin_multibulk, #dispatch_error, #dispatch_response, #fetch_response_callback
Methods included from Parser
Class Method Details
.connect(options = {}) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/sensu/redis.rb', line 32 def connect(={}) if .is_a?(String) = parse_url() end [:host] ||= "127.0.0.1" [:port] = ([:port] || 6379).to_i EM.connect([:host], [:port], self, ) end |
.parse_url(url) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sensu/redis.rb', line 19 def parse_url(url) begin uri = URI.parse(url) { :host => uri.host, :port => uri.port, :password => uri.password } rescue raise ArgumentError, "invalid redis url" end end |