tr8n_core 4.0.9 → 4.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tr8n/application.rb +7 -3
- data/lib/tr8n/session.rb +2 -0
- data/lib/tr8n/tokenizers/decoration.rb +6 -2
- data/lib/tr8n_core/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: dd3eb7989301e2c1d7d8734911a9ca036f0d5d51
|
4
|
+
data.tar.gz: eef105b2a1f9ace58ce79f4acfc3f44c5cfdf7fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ec1c94fe137730ca4c2d5365f980e43ceeaa9abdb39dfaa07ae750acb8662de91b85105f4c494a3e6fd0636e4dcb7afc74813e51bf0ee6bad429540ccb59998
|
7
|
+
data.tar.gz: 5e9c34a75ecb81b1d1059b27524c3061f284b649a649810336a8dd818d4fec0f0908881a5f982035984c22400ed3074e4f8696c243949fc9bf4bac22658bb155
|
data/lib/tr8n/application.rb
CHANGED
@@ -169,15 +169,19 @@ class Tr8n::Application < Tr8n::Base
|
|
169
169
|
submit_missing_keys if Tr8n.config.submit_missing_keys_realtime
|
170
170
|
end
|
171
171
|
|
172
|
-
def
|
173
|
-
return if @missing_keys_by_sources.nil? or @missing_keys_by_sources.empty?
|
172
|
+
def register_keys(keys)
|
174
173
|
params = []
|
175
|
-
|
174
|
+
keys.each do |source, keys|
|
176
175
|
next unless keys.values.any?
|
177
176
|
params << {:source => source, :keys => keys.values.collect{|tkey| tkey.to_hash(:label, :description, :locale, :level)}}
|
178
177
|
end
|
179
178
|
|
180
179
|
api_client.post('source/register_keys', {:source_keys => params.to_json})
|
180
|
+
end
|
181
|
+
|
182
|
+
def submit_missing_keys
|
183
|
+
return if @missing_keys_by_sources.nil? or @missing_keys_by_sources.empty?
|
184
|
+
register_keys(@missing_keys_by_sources)
|
181
185
|
@missing_keys_by_sources = nil
|
182
186
|
end
|
183
187
|
|
data/lib/tr8n/session.rb
CHANGED
@@ -42,6 +42,8 @@ module Tr8n
|
|
42
42
|
:current_source, :current_component, :block_options
|
43
43
|
|
44
44
|
def init(key = nil, secret = nil, host = nil)
|
45
|
+
return unless Tr8n.config.enabled? and Tr8n.config.application
|
46
|
+
|
45
47
|
key ||= Tr8n.config.application[:key]
|
46
48
|
secret ||= Tr8n.config.application[:secret]
|
47
49
|
host ||= Tr8n.config.application[:host]
|
@@ -122,7 +122,7 @@ module Tr8n
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def default_decoration(token_name, token_value)
|
125
|
-
default_decoration = Tr8n.config.default_token_value(token_name, :decoration)
|
125
|
+
default_decoration = Tr8n.config.default_token_value(normalize_token(token_name), :decoration)
|
126
126
|
|
127
127
|
unless default_decoration
|
128
128
|
Tr8n.logger.error("Invalid decoration token value for #{token_name} in #{text}")
|
@@ -171,7 +171,7 @@ module Tr8n
|
|
171
171
|
return value
|
172
172
|
end
|
173
173
|
|
174
|
-
if Tr8n.config.default_token_value(token, :decoration)
|
174
|
+
if Tr8n.config.default_token_value(normalize_token(token), :decoration)
|
175
175
|
return default_decoration(token, value)
|
176
176
|
end
|
177
177
|
|
@@ -179,6 +179,10 @@ module Tr8n
|
|
179
179
|
value
|
180
180
|
end
|
181
181
|
|
182
|
+
def normalize_token(name)
|
183
|
+
name.to_s.gsub(/(\d)*$/, '')
|
184
|
+
end
|
185
|
+
|
182
186
|
def evaluate(expr)
|
183
187
|
unless expr.is_a?(Array)
|
184
188
|
return expr
|
data/lib/tr8n_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tr8n_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|