File tree Expand file tree Collapse file tree 4 files changed +27
-27
lines changed Expand file tree Collapse file tree 4 files changed +27
-27
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,16 @@ class Kredis::Types::Counter < Kredis::Types::Proxying
4
4
attr_accessor :expires_in
5
5
6
6
def increment ( by : 1 )
7
- multi do | pipeline |
8
- pipeline . set 0 , ex : expires_in , nx : true
9
- pipeline . incrby by
7
+ multi do
8
+ set 0 , ex : expires_in , nx : true
9
+ incrby by
10
10
end [ -1 ]
11
11
end
12
12
13
13
def decrement ( by : 1 )
14
- multi do | pipeline |
15
- pipeline . set 0 , ex : expires_in , nx : true
16
- pipeline . decrby by
14
+ multi do
15
+ set 0 , ex : expires_in , nx : true
16
+ decrby by
17
17
end [ -1 ]
18
18
end
19
19
Original file line number Diff line number Diff line change @@ -8,16 +8,16 @@ def elements
8
8
end
9
9
alias to_a elements
10
10
11
- def remove ( *elements , pipeline : nil )
12
- types_to_strings ( elements , typed ) . each { |element | ( pipeline || proxy ) . lrem 0 , element }
11
+ def remove ( *elements )
12
+ types_to_strings ( elements , typed ) . each { |element | lrem 0 , element }
13
13
end
14
14
15
- def prepend ( *elements , pipeline : nil )
16
- ( pipeline || proxy ) . lpush types_to_strings ( elements , typed ) if elements . flatten . any?
15
+ def prepend ( *elements )
16
+ lpush types_to_strings ( elements , typed ) if elements . flatten . any?
17
17
end
18
18
19
- def append ( *elements , pipeline : nil )
20
- ( pipeline || proxy ) . rpush types_to_strings ( elements , typed ) if elements . flatten . any?
19
+ def append ( *elements )
20
+ rpush types_to_strings ( elements , typed ) if elements . flatten . any?
21
21
end
22
22
alias << append
23
23
Original file line number Diff line number Diff line change @@ -8,19 +8,19 @@ def members
8
8
end
9
9
alias to_a members
10
10
11
- def add ( *members , pipeline : nil )
12
- ( pipeline || proxy ) . sadd types_to_strings ( members , typed ) if members . flatten . any?
11
+ def add ( *members )
12
+ sadd types_to_strings ( members , typed ) if members . flatten . any?
13
13
end
14
14
alias << add
15
15
16
- def remove ( *members , pipeline : nil )
17
- ( pipeline || proxy ) . srem types_to_strings ( members , typed ) if members . flatten . any?
16
+ def remove ( *members )
17
+ srem types_to_strings ( members , typed ) if members . flatten . any?
18
18
end
19
19
20
20
def replace ( *members )
21
- multi do | pipeline |
22
- pipeline . del
23
- add members , pipeline : pipeline
21
+ multi do
22
+ del
23
+ add members
24
24
end
25
25
end
26
26
Original file line number Diff line number Diff line change @@ -8,21 +8,21 @@ def prepend(elements)
8
8
elements = Array ( elements ) . uniq
9
9
return if elements . empty?
10
10
11
- multi do | pipeline |
12
- remove elements , pipeline : pipeline
13
- super ( elements , pipeline : pipeline )
14
- pipeline . ltrim 0 , ( limit - 1 ) if limit
11
+ multi do
12
+ remove elements
13
+ super
14
+ ltrim 0 , ( limit - 1 ) if limit
15
15
end
16
16
end
17
17
18
18
def append ( elements )
19
19
elements = Array ( elements ) . uniq
20
20
return if elements . empty?
21
21
22
- multi do | pipeline |
23
- remove elements , pipeline : pipeline
24
- super ( elements , pipeline : pipeline )
25
- pipeline . ltrim -limit , -1 if limit
22
+ multi do
23
+ remove elements
24
+ super
25
+ ltrim -limit , -1 if limit
26
26
end
27
27
end
28
28
alias << append
You can’t perform that action at this time.
0 commit comments