kredis 1.3.0.1 → 1.4.0

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: 6042f4320cf89f8b0eae1ce4c8daa61ee6821775b7fdeab02777673a25b2cba1
4
- data.tar.gz: 67121a89444ffd7f8e0a1636fc6651a2851bbc5b63514a23413136bca2abd22d
3
+ metadata.gz: fdd8725b73c1bac9541b7b48ee62ebb46a8c51eaf78abe367fda75a12ee8c425
4
+ data.tar.gz: fcee76b43f62b3bd0a99fe7d258cb1b5edab0a8d7f408f15f7e11be01a40b219
5
5
  SHA512:
6
- metadata.gz: 81888671af0fb781788d890640142da0f36bf03589d628ec2aaeca1d86608d9602282a9b9955e0c496cd47be01d4f4e3e42d47ac9d9414949ca635c2768177b8
7
- data.tar.gz: eb7f0f1896bf2c27c4fa5630d43db65c8fcf183de9be5709146a3d06d183afdc33873f705a57dbbea5c58c2ca826758a82bd84ef81dfd320ca1d2a5c1c5eef1a
6
+ metadata.gz: 1bd30168c4efb0e23f65f15eb0e0b34c0b3a62a6c871da6be82192187482f0fddc55405ffb52c12f8dad4397246b55f7d292aa3bbbd8d3dc75a4fdd2e94e009e
7
+ data.tar.gz: 7dc32845d42347bcabe655447174d9cfb8b5e1d738fdf59af96557a455dc55ca52fced20fd76e514a21628dd725312120cbb6f0577e7925d6a6da585e77ffbf8
@@ -15,7 +15,7 @@ class Kredis::LogSubscriber < ActiveSupport::LogSubscriber
15
15
 
16
16
  private
17
17
  def formatted_in(color, event, type: nil)
18
- color " Kredis #{type} (#{event.duration.round(1)}ms) #{event.payload[:message]}", color, true
18
+ color " Kredis #{type} (#{event.duration.round(1)}ms) #{event.payload[:message]}", color, bold: true
19
19
  end
20
20
  end
21
21
 
@@ -4,11 +4,11 @@ module Kredis
4
4
  module Type
5
5
  class DateTime < ActiveModel::Type::DateTime
6
6
  def serialize(value)
7
- super&.iso8601(9)
7
+ super&.utc&.iso8601(9)
8
8
  end
9
9
 
10
10
  def cast_value(value)
11
- super&.to_datetime
11
+ super&.to_time
12
12
  end
13
13
  end
14
14
  end
@@ -24,4 +24,8 @@ class Kredis::Types::List < Kredis::Types::Proxying
24
24
  def clear
25
25
  del
26
26
  end
27
+
28
+ def last(n = nil)
29
+ n ? lrange(-n, -1) : lrange(-1, -1).first
30
+ end
27
31
  end
@@ -1,5 +1,5 @@
1
1
  class Kredis::Types::Set < Kredis::Types::Proxying
2
- proxying :smembers, :sadd, :srem, :multi, :del, :sismember, :scard, :spop, :exists?
2
+ proxying :smembers, :sadd, :srem, :multi, :del, :sismember, :scard, :spop, :exists?, :srandmember
3
3
 
4
4
  attr_accessor :typed
5
5
 
@@ -33,10 +33,18 @@ class Kredis::Types::Set < Kredis::Types::Proxying
33
33
  end
34
34
 
35
35
  def take
36
- spop
36
+ string_to_type(spop, typed)
37
37
  end
38
38
 
39
39
  def clear
40
40
  del
41
41
  end
42
+
43
+ def sample(count = nil)
44
+ if count.nil?
45
+ string_to_type(srandmember(count), typed)
46
+ else
47
+ strings_to_types(srandmember(count), typed)
48
+ end
49
+ end
42
50
  end
@@ -1,3 +1,3 @@
1
1
  module Kredis
2
- VERSION = "1.3.0.1"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kredis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Timm Hansen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-13 00:00:00.000000000 Z
12
+ date: 2023-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 6.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: activemodel
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 6.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 6.0.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: redis
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
129
  - !ruby/object:Gem::Version
116
130
  version: '0'
117
131
  requirements: []
118
- rubygems_version: 3.4.2
132
+ rubygems_version: 3.4.10
119
133
  signing_key:
120
134
  specification_version: 4
121
135
  summary: Higher-level data structures built on Redis.