redpear 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/redpear/connection.rb +26 -36
  2. metadata +16 -16
@@ -5,42 +5,30 @@
5
5
  #
6
6
  class Redpear::Connection
7
7
 
8
- MASTER_METHODS = %w|
9
- append auth
10
- bgrewriteaof bgsave blpop brpop brpoplpush
11
- config
12
- decr decrby del discard
13
- exec expire expireat
14
- flushall flushdb getset
15
- hset hsetnx hincrby hmset hdel
16
- incr incrby
17
- linsert lpop lpush lpushx lrem lset ltrim
18
- mapped_hmset mapped_mset mapped_msetnx
19
- move mset msetnx multi
20
- persist pipelined psubscribe punsubscribe quit
21
- rename renamenx rpop rpoplpush rpush rpushx
22
- sadd save sdiffstore set setbit
23
- setex setnx setrange sinterstore
24
- shutdown smove spop srem subscribe
25
- sunionstore sync synchronize
26
- unsubscribe unwatch watch
27
- zadd zincrby zinterstore zrem
28
- zremrangebyrank zremrangebyscore zunionstore
29
- |.freeze
8
+ MASTER_METHODS = [
9
+ :append, :blpop, :brpop, :brpoplpush, :decr, :decrby, :del, :discard,
10
+ :exec, :expire, :expireat, :getset, :hset, :hsetnx, :hincrby, :hmset,
11
+ :hdel, :incr, :incrby, :linsert, :lpop, :lpush, :lpushx, :lrem, :lset,
12
+ :ltrim, :mapped_hmset, :mapped_mset, :mapped_msetnx, :move, :mset, :msetnx,
13
+ :multi, :persist, :pipelined, :rename, :renamenx, :rpop, :rpoplpush,
14
+ :rpush, :rpushx, :sadd, :sdiffstore, :set, :setbit, :setex, :setnx,
15
+ :setrange, :sinterstore, :smove, :spop, :srem, :sunionstore, :unwatch,
16
+ :watch, :zadd, :zincrby, :zinterstore, :zrem, :zremrangebyrank,
17
+ :zremrangebyscore, :zunionstore, :[]=
18
+ ].freeze
30
19
 
31
- SLAVE_METHODS = %w|
32
- dbsize debug get getbit getrange
33
- echo exists
34
- hget hmget hexists hlen hkeys hvals hgetall
35
- info keys lastsave lindex llen lrange
36
- mapped_hmget mapped_mget mget monitor
37
- object ping publish randomkey
38
- scard sdiff select sinter sismember slaveof
39
- smembers sort srandmember strlen substr sunion
40
- ttl type
41
- zcard zcount zrange zrangebyscore zrank
42
- zrevrange zrevrangebyscore zrevrank zscore
43
- |.freeze
20
+ SLAVE_METHODS = [
21
+ :auth, :bgrewriteaof, :bgsave, :config, :dbsize, :debug, :get, :getbit,
22
+ :getrange, :echo, :exists, :flushall, :flushdb, :hget, :hmget, :hexists,
23
+ :hlen, :hkeys, :hvals, :hgetall, :info, :keys, :lastsave, :lindex, :llen,
24
+ :lrange, :mapped_hmget, :mapped_mget, :mget, :monitor, :object, :ping,
25
+ :publish, :psubscribe, :punsubscribe, :quit, :randomkey, :save, :scard,
26
+ :sdiff, :select, :shutdown, :sinter, :sismember, :slaveof, :smembers,
27
+ :sort, :srandmember, :strlen, :subscribe, :subscribed?, :substr, :sunion,
28
+ :sync, :synchronize, :ttl, :type, :unsubscribe, :zcard, :zcount, :zrange,
29
+ :zrangebyscore, :zrank, :zrevrange, :zrevrangebyscore, :zrevrank, :zscore,
30
+ :[]
31
+ ].freeze
44
32
 
45
33
  # @return [Symbol] ther current connection, either :master or :slave
46
34
  attr_reader :current
@@ -74,9 +62,11 @@ class Redpear::Connection
74
62
  # Either :master or :slave
75
63
  # @yield
76
64
  # Perform a block with the given connection
65
+ # @yieldparam [Redpear::Connection]
66
+ # The chosen connection, master or slave
77
67
  def on(name)
78
68
  @current = send(name)
79
- yield
69
+ yield(@current)
80
70
  ensure
81
71
  @current = nil
82
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redpear
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-31 00:00:00.000000000Z
12
+ date: 2012-02-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &22040360 !ruby/object:Gem::Requirement
16
+ requirement: &12271520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22040360
24
+ version_requirements: *12271520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &22039760 !ruby/object:Gem::Requirement
27
+ requirement: &12270600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *22039760
35
+ version_requirements: *12270600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &22038240 !ruby/object:Gem::Requirement
38
+ requirement: &12269320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *22038240
46
+ version_requirements: *12269320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &22036720 !ruby/object:Gem::Requirement
49
+ requirement: &12268520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *22036720
57
+ version_requirements: *12268520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: shoulda-matchers
60
- requirement: &22035080 !ruby/object:Gem::Requirement
60
+ requirement: &12267600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *22035080
68
+ version_requirements: *12267600
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: machinist
71
- requirement: &22033100 !ruby/object:Gem::Requirement
71
+ requirement: &12266520 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *22033100
79
+ version_requirements: *12266520
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: factory_girl
82
- requirement: &22032660 !ruby/object:Gem::Requirement
82
+ requirement: &12265780 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *22032660
90
+ version_requirements: *12265780
91
91
  description: Simple, elegant & efficient ORM for Redis
92
92
  email: dimitrij@blacksquaremedia.com
93
93
  executables: []