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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5d6598f1871117da1975503815421dff165daf9
4
- data.tar.gz: e60f6a755c7fede60e1b47daf39ff93e0145636f
3
+ metadata.gz: dd3eb7989301e2c1d7d8734911a9ca036f0d5d51
4
+ data.tar.gz: eef105b2a1f9ace58ce79f4acfc3f44c5cfdf7fc
5
5
  SHA512:
6
- metadata.gz: ccdd9f1b867a34c5bd87f195f57983606b18bacf0f65a0d227637fb761fd40d9a0050744d617d5d2a422be2c9fb4001f6dd7790a5fc406114716ccb68814a367
7
- data.tar.gz: 0c718d53381c1ae518576653bd3db3c7a0c57834e2f38593f39c7ab87f66801b000f1cfc13cc0279f2142768c151abc92168ecbd0bcd26888d586088e88a6b8f
6
+ metadata.gz: 6ec1c94fe137730ca4c2d5365f980e43ceeaa9abdb39dfaa07ae750acb8662de91b85105f4c494a3e6fd0636e4dcb7afc74813e51bf0ee6bad429540ccb59998
7
+ data.tar.gz: 5e9c34a75ecb81b1d1059b27524c3061f284b649a649810336a8dd818d4fec0f0908881a5f982035984c22400ed3074e4f8696c243949fc9bf4bac22658bb155
@@ -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 submit_missing_keys
173
- return if @missing_keys_by_sources.nil? or @missing_keys_by_sources.empty?
172
+ def register_keys(keys)
174
173
  params = []
175
- @missing_keys_by_sources.each do |source, keys|
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
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module Tr8nCore
33
- VERSION = "4.0.9"
33
+ VERSION = '4.0.10'
34
34
  end
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.9
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-14 00:00:00.000000000 Z
11
+ date: 2014-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday