tml-rails 5.1.2 → 5.2.1

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: a537d22885f54958a20638d66b8356792d7e6e05
4
- data.tar.gz: df0675cdbf1573d18b02732bf2df544b9e9d953a
3
+ metadata.gz: 1686ece654b47d5e607faf3a8160637470df42dc
4
+ data.tar.gz: 873f2fe4d1d5f45038cecc34048861fd3a80249d
5
5
  SHA512:
6
- metadata.gz: 03ab8362f41ec90f7e5d252a4e5a9184cfbafc707ab86c1b3571780ca823d7d52213f2f924b60eefba2abdb3cc2a687f44f2c452905b631e6fd6bc312e1237eb
7
- data.tar.gz: de38a043dfa40efb0776be48113996df20c295ec383b2cf0953b9ae794a47600cd4130f171f5e798cb6cf43828ae5b5eac72d5b3922862a80fd0811e7217af13
6
+ metadata.gz: e0cb96e9ca1cc4f5167ce9ddcab45e6a7714b2064db7b02db211aa24d1532ede89a9b340d276caebe83cfbe0d22cb58692829b6337539ec37abc6752fb5c8805
7
+ data.tar.gz: 5df1217ba2837c069216920d7e4803c077b38be7fc8aceea0af2d1293395d137ebeadecb362150f7e1109ba2ef3c8d3c13e4ba8561f5eae66f1076da1ef4435e
@@ -36,10 +36,8 @@ module TmlRails
36
36
  base.send(:include, TmlRails::ActionCommonMethods)
37
37
  base.send(:include, InstanceMethods)
38
38
 
39
- if Tml.config.auto_init
40
- base.before_filter :tml_init
41
- base.after_filter :tml_reset
42
- end
39
+ base.before_filter :tml_filter_init
40
+ base.after_filter :tml_filter_reset
43
41
 
44
42
  if defined? base.rescue_from
45
43
  base.rescue_from 'Tml::Exception' do |e|
@@ -65,14 +63,10 @@ module TmlRails
65
63
  self.class.name
66
64
  end
67
65
 
68
- def tml_cookie_name
69
- Tml::Utils.cookie_name(Tml.config.application[:key])
70
- end
71
-
72
66
  # Returns data from cookie set by the agent
73
67
  def tml_cookie
74
68
  @tml_cookie ||= begin
75
- cookie = cookies[tml_cookie_name]
69
+ cookie = cookies[Tml::Utils.cookie_name(Tml.config.application[:key])]
76
70
  if cookie.blank?
77
71
  {}
78
72
  else
@@ -147,12 +141,12 @@ module TmlRails
147
141
 
148
142
  @tml_started_at = Time.now
149
143
 
150
- Tml.session.init({
151
- :source => tml_source,
152
- :locale => tml_locale,
153
- :user => tml_viewing_user,
154
- :translator => tml_translator
155
- })
144
+ Tml.session.init(
145
+ :source => tml_source,
146
+ :locale => tml_locale,
147
+ :user => tml_viewing_user,
148
+ :translator => tml_translator
149
+ )
156
150
 
157
151
  if I18n.backend.class.name == 'I18n::Backend::Tml'
158
152
  if defined? I18n.enforce_available_locales
@@ -162,15 +156,23 @@ module TmlRails
162
156
  end
163
157
  end
164
158
 
159
+ def tml_filter_init
160
+ tml_init if Tml.config.auto_init
161
+ end
162
+
165
163
  def tml_reset
166
164
  return if Tml.config.disabled?
167
165
  @tml_finished_at = Time.now
168
- tml_application.submit_missing_keys
166
+ Tml.session.application.submit_missing_keys if Tml.session.application
169
167
  Tml.session.reset
170
168
  Tml.cache.reset_version
171
169
  Tml.logger.info("Request took #{@tml_finished_at - @tml_started_at} mls") if @tml_started_at
172
170
  end
173
171
 
172
+ def tml_filter_reset
173
+ tml_reset if Tml.config.auto_init
174
+ end
175
+
174
176
  end
175
177
  end
176
178
  end
@@ -34,6 +34,7 @@ module TmlRails
34
34
  extend ActiveSupport::Concern
35
35
 
36
36
  # Translates HTML block
37
+ # noinspection RubyArgCount
37
38
  def trh(tokens = {}, options = {}, &block)
38
39
  return '' unless block_given?
39
40
 
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module TmlRails
33
- VERSION = '5.1.2'
33
+ VERSION = '5.2.1'
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.2
4
+ version: 5.2.1
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-11-01 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '5.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: '5.2'
41
41
  description: Translation Markup Language from Translation Exchange.
42
42
  email:
43
43
  - michael@translationexchange.com