tml 5.5.3 → 5.5.4
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/config.rb +1 -1
- data/lib/tml/tokens/data.rb +10 -3
- 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: 01627bae72095f4b9e7ce0e7075321bf8c6354fa
|
4
|
+
data.tar.gz: a2a539378307191e667ce9624a9c4708c3904412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40bb60e7df1e3a58d41c5fd8eec56848c7290e553646701d1895c69b73c37f51481fbb3be1aa96973b869804f16838458e565a135e2578ee0fab08f4be140372
|
7
|
+
data.tar.gz: f469500ca7422f2f43e58f11b8184ebd832c2aeb6a501482d83c89bb0b1dd443132204676e70525f4bbca1180ce2161cd62a544a3a722b859a8859141c42da94
|
data/lib/tml/config.rb
CHANGED
data/lib/tml/tokens/data.rb
CHANGED
@@ -290,9 +290,11 @@ module Tml
|
|
290
290
|
|
291
291
|
##############################################################################
|
292
292
|
#
|
293
|
+
# Hashes are often used with JSON structures. We can be smart about how to pull default values.
|
294
|
+
#
|
293
295
|
# examples:
|
294
296
|
#
|
295
|
-
# tr("Hello {user}", {:user => {:
|
297
|
+
# tr("Hello {user}", {:user => {:name => "Michael", :gender => :male}}}
|
296
298
|
#
|
297
299
|
# tr("Hello {user}", {:user => {:object => {:gender => :male}, :value => "Michael"}}}
|
298
300
|
# tr("Hello {user}", {:user => {:object => {:name => "Michael", :gender => :male}, :property => :name}}}
|
@@ -306,6 +308,13 @@ module Tml
|
|
306
308
|
|
307
309
|
def token_value_from_hash_param(hash, language, options)
|
308
310
|
value = Tml::Utils.hash_value(hash, :value)
|
311
|
+
[:name, :first_name, :display_name, :full_name, :username].each do |attr|
|
312
|
+
value ||= Tml::Utils.hash_value(hash, attr)
|
313
|
+
end
|
314
|
+
|
315
|
+
attr = Tml::Utils.hash_value(hash, :attribute) || Tml::Utils.hash_value(hash, :property)
|
316
|
+
value ||= Tml::Utils.hash_value(hash, attr)
|
317
|
+
|
309
318
|
object = Tml::Utils.hash_value(hash, :object)
|
310
319
|
|
311
320
|
unless value.nil?
|
@@ -316,8 +325,6 @@ module Tml
|
|
316
325
|
return error("Missing value for hash token #{full_name} in #{label}")
|
317
326
|
end
|
318
327
|
|
319
|
-
attr = Tml::Utils.hash_value(hash, :attribute) || Tml::Utils.hash_value(hash, :property)
|
320
|
-
|
321
328
|
if object.is_a?(Hash)
|
322
329
|
unless attr.nil?
|
323
330
|
return sanitize(Tml::Utils.hash_value(object, attr), object, language, options.merge(:safe => false))
|
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.5.
|
4
|
+
version: 5.5.4
|
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-06-
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|