air18n 0.1.53 → 0.1.54
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/air18n/chunk_cache.rb +3 -3
- data/lib/air18n/version.rb +1 -1
- metadata +3 -3
data/lib/air18n/chunk_cache.rb
CHANGED
@@ -22,14 +22,14 @@ module Air18n
|
|
22
22
|
|
23
23
|
# We use divmod to avoid the edge condition where the floating point math
|
24
24
|
# result is 5.000001 and the ceil would result in 6.
|
25
|
-
quotient, modulus = value_json.
|
25
|
+
quotient, modulus = value_json.bytesize.divmod(MAX_CHUNK_SIZE)
|
26
26
|
num_chunks = modulus > 0 ? quotient + 1 : quotient
|
27
27
|
cache.write(CHECKSUM_CACHE_KEY % key, [num_chunks, Zlib::crc32(value_json)].to_json)
|
28
28
|
|
29
29
|
1.upto(num_chunks) do |i|
|
30
|
-
chunk = value_json
|
30
|
+
chunk = value_json.byteslice((i-1)*MAX_CHUNK_SIZE, MAX_CHUNK_SIZE)
|
31
31
|
if cache.write(CHUNK_CACHE_KEY % [key, i], chunk, :expires_in => expires_in) == false
|
32
|
-
LoggingHelper.error "ChunkCache set: failed to write chunk #{CHUNK_CACHE_KEY % [key, i]} (#{chunk.size} bytes)"
|
32
|
+
LoggingHelper.error "ChunkCache set: failed to write chunk #{CHUNK_CACHE_KEY % [key, i]} (#{chunk.size} chars / #{chunk.bytesize} bytes)"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/air18n/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: air18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.54
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-01-
|
16
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: i18n
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
version: '0'
|
220
220
|
requirements: []
|
221
221
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.8.
|
222
|
+
rubygems_version: 1.8.24
|
223
223
|
signing_key:
|
224
224
|
specification_version: 3
|
225
225
|
summary: Dynamic I18n backend
|