readthis 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/readthis/cache.rb +8 -2
- data/lib/readthis/expanders.rb +1 -1
- data/lib/readthis/version.rb +1 -1
- data/spec/readthis/cache_spec.rb +6 -0
- data/spec/readthis/expanders_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96757292ab53002644528d813c7100a0f9162cbe
|
4
|
+
data.tar.gz: cd567c4a99b251982d9ecd23abeb328a40574531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea89804bbc66cc15c8c3f605b9c918624ee9a5e1a64da125c81b6ae6e6964a906374c564a931a2fa41ccc86463f6084e55a28f88c514bf56f8aa81f534fb4985
|
7
|
+
data.tar.gz: eda30ec91065ccb9dfb5ef3e47a79b7eac16fdc6896674793dee7f95beac5d6ba32fef8d1d7c28e70f96ef8f050236c43678b6fc3ca5afabf84e8fb9cb220b83
|
data/lib/readthis/cache.rb
CHANGED
@@ -389,8 +389,8 @@ module Readthis
|
|
389
389
|
end
|
390
390
|
|
391
391
|
def write_entity(key, value, store, options)
|
392
|
-
namespaced = namespaced_key(key, options)
|
393
|
-
dumped = entity.dump(value, options)
|
392
|
+
namespaced = encode(namespaced_key(key, options))
|
393
|
+
dumped = encode(entity.dump(value, options))
|
394
394
|
|
395
395
|
if (expiration = options[:expires_in])
|
396
396
|
store.setex(namespaced, coerce_expiration(expiration), dumped)
|
@@ -411,6 +411,12 @@ module Readthis
|
|
411
411
|
Float(expires_in).ceil
|
412
412
|
end
|
413
413
|
|
414
|
+
def encode(string)
|
415
|
+
string = string.frozen? ? string.dup : string
|
416
|
+
|
417
|
+
string.force_encoding(Encoding::BINARY)
|
418
|
+
end
|
419
|
+
|
414
420
|
def instrument(name, key)
|
415
421
|
if self.class.notifications
|
416
422
|
name = "cache_#{name}.active_support"
|
data/lib/readthis/expanders.rb
CHANGED
data/lib/readthis/version.rb
CHANGED
data/spec/readthis/cache_spec.rb
CHANGED
@@ -76,6 +76,12 @@ RSpec.describe Readthis::Cache do
|
|
76
76
|
|
77
77
|
expect(cache.read('custom')).to eq('some-value')
|
78
78
|
end
|
79
|
+
|
80
|
+
it 'stores russian symbols by russian key' do
|
81
|
+
cache.write('вгдмн', 'вгдмн')
|
82
|
+
|
83
|
+
expect(cache.read('вгдмн')).to eq('вгдмн')
|
84
|
+
end
|
79
85
|
end
|
80
86
|
|
81
87
|
describe '#read' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readthis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Selbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|