tml 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/tml/cache_adapters/redis.rb +10 -3
- data/lib/tml/config.rb +1 -1
- data/lib/tml/version.rb +1 -1
- 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: 8cb97be993ac6b62a23169eed2b85c4bada498fd
|
4
|
+
data.tar.gz: 4c26fe9e93653f846bef308a83072fdf24860c4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dab4c995a187be0e6ae96ad1a8e841908b757db025e0637075aac2083988e4391c5e5bba87aeea8ceee6bb7f843f4ed2c64583b97ae3a0cf660b3638f9d412a
|
7
|
+
data.tar.gz: cb35f547b74edd78f2a6052b5a9667cd6dc61c2a95e685fb164c3ac636e29ecdceea4aa660af55c66bf808a0130e1b4a19ef2eabfb6a04c06a8cb819832b1779
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@ TML Library For Ruby
|
|
6
6
|
==================
|
7
7
|
[![Build Status](https://travis-ci.org/translationexchange/tml-ruby.png?branch=master)](https://travis-ci.org/translationexchange/tml-ruby)
|
8
8
|
[![Coverage Status](https://coveralls.io/repos/translationexchange/tml-ruby/badge.png?branch=master)](https://coveralls.io/r/translationexchange/tml-ruby?branch=master)
|
9
|
-
[![Gem Version](https://badge.fury.io/rb/tml-ruby.png)](http://badge.fury.io/rb/tml)
|
10
9
|
[![Dependency Status](https://www.versioneye.com/user/projects/54c1457a6c00352081000416/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54c1457a6c00352081000416)
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/tml.svg)](http://badge.fury.io/rb/tml)
|
11
11
|
|
12
12
|
TML library for Ruby is a set of classes that provide translation functionality for any Ruby based application.
|
13
13
|
The library uses Translation Markup Language that allows you to encode complex language structures in simple, yet powerful forms.
|
@@ -44,7 +44,7 @@ class Tml::CacheAdapters::Redis < Tml::Cache
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def cache_name
|
47
|
-
|
47
|
+
'redis'
|
48
48
|
end
|
49
49
|
|
50
50
|
def read_only?
|
@@ -55,7 +55,12 @@ class Tml::CacheAdapters::Redis < Tml::Cache
|
|
55
55
|
data = @cache.get(versioned_key(key, opts))
|
56
56
|
if data
|
57
57
|
info("Cache hit: #{key}")
|
58
|
-
|
58
|
+
|
59
|
+
begin
|
60
|
+
return JSON.parse(data)
|
61
|
+
rescue Exception => ex
|
62
|
+
warn("Failed to parse data: #{ex.message}")
|
63
|
+
end
|
59
64
|
end
|
60
65
|
|
61
66
|
info("Cache miss: #{key}")
|
@@ -69,16 +74,18 @@ class Tml::CacheAdapters::Redis < Tml::Cache
|
|
69
74
|
data
|
70
75
|
rescue Exception => ex
|
71
76
|
warn("Failed to retrieve data: #{ex.message}")
|
77
|
+
pp ex, ex.backtrace
|
72
78
|
return nil unless block_given?
|
73
79
|
yield
|
74
80
|
end
|
75
81
|
|
76
82
|
def store(key, data, opts = {})
|
77
83
|
info("Cache store: #{key}")
|
84
|
+
|
78
85
|
ttl = opts[:ttl] || Tml.config.cache[:timeout]
|
79
86
|
versioned_key = versioned_key(key, opts)
|
80
87
|
|
81
|
-
@cache.set(versioned_key, data)
|
88
|
+
@cache.set(versioned_key, data.to_json)
|
82
89
|
@cache.expire(versioned_key, ttl) if ttl and ttl > 0
|
83
90
|
rescue Exception => ex
|
84
91
|
warn("Failed to store data: #{ex.message}")
|
data/lib/tml/config.rb
CHANGED
@@ -334,7 +334,7 @@ module Tml
|
|
334
334
|
|
335
335
|
def default_language
|
336
336
|
@default_language ||= begin
|
337
|
-
file = File.expand_path(File.join(File.dirname(__FILE__), '..', '
|
337
|
+
file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tml', 'languages', "#{Tml.config.default_locale}.json"))
|
338
338
|
Tml::Language.new(JSON.parse(File.read(file)))
|
339
339
|
end
|
340
340
|
end
|
data/lib/tml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|