tml 5.4.5 → 5.4.6
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/tml/cache_version.rb +5 -5
- data/lib/tml/config.rb +4 -12
- data/lib/tml/ext/array.rb +2 -1
- data/lib/tml/session.rb +3 -2
- data/lib/tml/tokens/data.rb +7 -1
- data/lib/tml/tokens/transform.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: cabb1d4b4e4a202fda309b2d0f140a1f4c91c58f
|
4
|
+
data.tar.gz: c332c1f7653cecbc6ac7b619fa3d9e00a4a1483d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d64b807628e15e3d18cb7cacba69d1e4fd5407dd62fb35e27d37f04b48df82e50c12feec2e845c46ac0d97ee5796028b53b02eda76b3be2e763963ac83d82ccc
|
7
|
+
data.tar.gz: 1deca44da3cb162a4355aa4b4e17438f750852f1567c2c515682f3d913e37f4d9edbe460212175bd626c9a1da3fa6d245ad5d3e84378de7b75e694dcc6e73bc1
|
data/lib/tml/cache_version.rb
CHANGED
@@ -68,12 +68,12 @@ module Tml
|
|
68
68
|
expires_at = version['t'] + version_check_interval
|
69
69
|
if expires_at < Time.now.to_i
|
70
70
|
Tml.logger.debug('Cache version is outdated, needs refresh')
|
71
|
-
'undefined'
|
72
|
-
else
|
73
|
-
delta = expires_at - Time.now.to_i
|
74
|
-
Tml.logger.debug("Cache version is up to date, expires in #{delta}s")
|
75
|
-
version['version']
|
71
|
+
return 'undefined'
|
76
72
|
end
|
73
|
+
|
74
|
+
delta = expires_at - Time.now.to_i
|
75
|
+
Tml.logger.debug("Cache version is up to date, expires in #{delta}s")
|
76
|
+
version['version']
|
77
77
|
end
|
78
78
|
|
79
79
|
# fetches the version from the cache
|
data/lib/tml/config.rb
CHANGED
@@ -289,19 +289,11 @@ module Tml
|
|
289
289
|
}
|
290
290
|
}
|
291
291
|
|
292
|
-
@invalidator ||= {
|
293
|
-
enabled: true,
|
294
|
-
path: '/tml/upgrade',
|
295
|
-
auth: lambda do |request|
|
296
|
-
request.params[:access_token] == application[:token]
|
297
|
-
end
|
298
|
-
}
|
299
|
-
|
300
292
|
@localization = {
|
301
|
-
:default_day_names =>
|
302
|
-
:default_abbr_day_names =>
|
303
|
-
:default_month_names =>
|
304
|
-
:default_abbr_month_names =>
|
293
|
+
:default_day_names => %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday),
|
294
|
+
:default_abbr_day_names => %w(Sun Mon Tue Wed Thu Fri Sat),
|
295
|
+
:default_month_names => %w(January February March April May June July August September October November December),
|
296
|
+
:default_abbr_month_names => %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec),
|
305
297
|
:custom_date_formats => {
|
306
298
|
:default => '%m/%d/%Y', # 07/4/2008
|
307
299
|
:short_numeric => '%m/%d', # 07/4
|
data/lib/tml/ext/array.rb
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
class Array
|
33
33
|
|
34
34
|
# translates an array of options for a select tag
|
35
|
-
def
|
35
|
+
def translate_options(description = '', options = {})
|
36
36
|
return [] if empty?
|
37
37
|
|
38
38
|
options = options.merge(:skip_decorations => true)
|
@@ -47,6 +47,7 @@ class Array
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
+
alias_method :tro, :translate_options
|
50
51
|
|
51
52
|
# translates and joins all elements
|
52
53
|
def translate_and_join(separator = ', ', description = '', options = {})
|
data/lib/tml/session.rb
CHANGED
@@ -46,7 +46,7 @@ module Tml
|
|
46
46
|
key = opts[:key] || Tml.config.application[:key]
|
47
47
|
host = opts[:host] || Tml.config.application[:host]
|
48
48
|
cdn_host = opts[:cdn_host] || Tml.config.application[:cdn_host]
|
49
|
-
token = opts[:access_token] || Tml.config.application[:token]
|
49
|
+
token = opts[:access_token] || opts[:token] || Tml.config.application[:token]
|
50
50
|
|
51
51
|
Tml.cache.reset_version
|
52
52
|
|
@@ -102,7 +102,8 @@ module Tml
|
|
102
102
|
|
103
103
|
def target_language
|
104
104
|
target_locale = block_option(:target_locale)
|
105
|
-
target_locale ? application.language(target_locale) : current_language
|
105
|
+
language = (target_locale ? application.language(target_locale) : current_language)
|
106
|
+
language || Tml.config.default_language
|
106
107
|
end
|
107
108
|
|
108
109
|
def inline_mode?
|
data/lib/tml/tokens/data.rb
CHANGED
@@ -136,6 +136,7 @@ module Tml
|
|
136
136
|
# :separator => ', ',
|
137
137
|
# :joiner => 'and',
|
138
138
|
# :remainder => lambda{|elements| tr("#{count||other}", :count => elements.size)},
|
139
|
+
# :translate => false,
|
139
140
|
# :expandable => true,
|
140
141
|
# :collapsable => true
|
141
142
|
# })
|
@@ -254,7 +255,7 @@ module Tml
|
|
254
255
|
def token_value_from_array_param(array, language, options)
|
255
256
|
# if you provided an array, it better have some values
|
256
257
|
if array.size < 2
|
257
|
-
return
|
258
|
+
return sanitize(array[0], array[0], language, options.merge(:safe => false))
|
258
259
|
end
|
259
260
|
|
260
261
|
# if the first value of an array is an array handle it here
|
@@ -279,6 +280,11 @@ module Tml
|
|
279
280
|
return sanitize(array[0].send(array[1]), array[0], language, options.merge(:safe => false))
|
280
281
|
end
|
281
282
|
|
283
|
+
# if second param is a lambda
|
284
|
+
if array[1].is_a?(Proc)
|
285
|
+
return sanitize(array[1].call(array[0]), array[0], language, options.merge(:safe => false))
|
286
|
+
end
|
287
|
+
|
282
288
|
error("Invalid value for array token #{full_name} in #{label}")
|
283
289
|
end
|
284
290
|
|
data/lib/tml/tokens/transform.rb
CHANGED
@@ -103,7 +103,7 @@ class Tml::Tokens::Transform < Tml::Tokens::Data
|
|
103
103
|
# transform: ["unsupported", {"male": "{$0}", "female": "{$1}", "other": "{$0}/{$1}"}]
|
104
104
|
# results in: {"male": "Dorogoi", "female": "Dorogaya", "other": "Dorogoi/Dorogaya"}
|
105
105
|
#
|
106
|
-
# token: {actors
|
106
|
+
# token: {actors || likes, like}
|
107
107
|
# transform: ["unsupported", {"one": "{$0}", "other": "{$1}"}]
|
108
108
|
# results in: {"one": "likes", "other": "like"}
|
109
109
|
def generate_value_map(params, context)
|
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: 5.4.
|
4
|
+
version: 5.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|