redis-sentinel-url 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef3964644badc8936a934f7ba51d136e3634e9549c140e5538023fa3f50e4795
4
- data.tar.gz: ab5ff5b641ffe3725f54584e3bfefae136c8a80cad11994b218ea137091de36a
3
+ metadata.gz: 597faed5b262419e716b6f700b712ec5d67621607733c1956701c3a4a99215b5
4
+ data.tar.gz: cd8c90e51356a06de9a4214040195df552d13c294097e96037b8b78901f10b83
5
5
  SHA512:
6
- metadata.gz: 77e4580c2b166df99f06dd4166428a9cfa93e98d80b890a399ea577794830b901b3f79aea817e67678910a97aa441a8d7f166d55ef8d8a0b8ab6c59cb51bfeb9
7
- data.tar.gz: 8ad0f826e98bee480e966e4458937a80914525a766fbf0c809dcdd5d78da7a525f0f476cbf45b9978e7f0e267e477c5c8333c8692762653dbab9a12307549550
6
+ metadata.gz: 578e543656da5d461a44d9f9f49b910574a8b5b72d2f613942e05ca307beb9ac9a5dd3900d64977f8b480ec2ab4757dc641ddec6f3398e1af27808d8ac7032c9
7
+ data.tar.gz: ca7c9deb2c48ec97e448fb808a5f0f84cab83c09c91bf6f55768c1aa347f54695fabb894794d19cf5b6f5526f9ee767a46a38de5dc0c544624a5b37787b9a262
data/README.md CHANGED
@@ -18,7 +18,9 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- Once the code is `require`d (which happens automatically if you are using bundler) you can use the following URL syntax in the `REDIS_URL` environment variable, or passed to `Redis.new(url: ...)`:
21
+ `require 'redis/sentinel/url'`
22
+
23
+ You can then use the following URL syntax in the `REDIS_URL` environment variable, or passed to `Redis.new(url: ...)`:
22
24
 
23
25
  `redis+sentinel://host[:port][/service_name[/db]][?param1=value1[&param2=value=2&...]]`
24
26
 
@@ -44,25 +44,25 @@ class Redis
44
44
  uri_options
45
45
  end
46
46
  end
47
+ end
47
48
 
48
- module OptionParser
49
- def _parse_options(options)
50
- return options if options[:_parsed]
51
-
52
- default_url = ::Redis::Client::DEFAULTS[:url]
53
- default_url = default_url.call if default_url.respond_to?(:call)
49
+ module SentinelURLParser
50
+ def initialize(options = {})
51
+ return super unless options[:url]
54
52
 
55
- url = options[:url] || default_url
56
- if url.to_s.start_with?('redis+sentinel://')
57
- options = options.merge(Redis::Sentinel::URL.parse(url))
58
- end
53
+ default_url = ::Redis::Client::DEFAULTS[:url]
54
+ default_url = default_url.call if default_url.respond_to?(:call)
59
55
 
60
- super(options)
56
+ url = options[:url] || default_url
57
+ if url.to_s.start_with?('redis+sentinel://')
58
+ options = options.merge(Redis::Sentinel::URL.parse(url))
61
59
  end
60
+
61
+ super(options)
62
62
  end
63
63
  end
64
64
  end
65
65
 
66
- class ::Redis::Client
67
- prepend Redis::Sentinel::OptionParser
66
+ class ::Redis
67
+ prepend Redis::SentinelURLParser
68
68
  end
@@ -1,7 +1,7 @@
1
1
  class Redis
2
2
  module Sentinel
3
3
  class Url
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-sentinel-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Holland