tr8n_core 4.0.6 → 4.0.7
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/README.md +11 -2
- data/lib/tr8n/api_client.rb +8 -0
- data/lib/tr8n/application.rb +8 -0
- data/lib/tr8n/base.rb +8 -0
- data/lib/tr8n/cache.rb +8 -0
- data/lib/tr8n/cache_adapters/cdb.rb +8 -0
- data/lib/tr8n/cache_adapters/file.rb +8 -0
- data/lib/tr8n/cache_adapters/memcache.rb +8 -0
- data/lib/tr8n/cache_adapters/redis.rb +9 -0
- data/lib/tr8n/component.rb +8 -0
- data/lib/tr8n/config.rb +8 -0
- data/lib/tr8n/decorators/base.rb +8 -0
- data/lib/tr8n/decorators/default.rb +8 -0
- data/lib/tr8n/decorators/html.rb +8 -0
- data/lib/tr8n/exception.rb +8 -0
- data/lib/tr8n/language.rb +8 -0
- data/lib/tr8n/language_case.rb +8 -0
- data/lib/tr8n/language_case_rule.rb +8 -0
- data/lib/tr8n/language_context.rb +8 -1
- data/lib/tr8n/language_context_rule.rb +8 -0
- data/lib/tr8n/logger.rb +8 -0
- data/lib/tr8n/rules_engine/evaluator.rb +8 -0
- data/lib/tr8n/rules_engine/parser.rb +8 -0
- data/lib/tr8n/session.rb +8 -0
- data/lib/tr8n/source.rb +8 -0
- data/lib/tr8n/tokens/data.rb +20 -14
- data/lib/tr8n/tokens/data_tokenizer.rb +8 -0
- data/lib/tr8n/tokens/decoration_tokenizer.rb +11 -22
- data/lib/tr8n/tokens/hidden.rb +8 -0
- data/lib/tr8n/tokens/method.rb +8 -0
- data/lib/tr8n/tokens/transform.rb +8 -0
- data/lib/tr8n/translation.rb +8 -0
- data/lib/tr8n/translation_key.rb +8 -0
- data/lib/tr8n/translator.rb +8 -0
- data/lib/tr8n/utils.rb +8 -0
- data/lib/tr8n_core/ext/array.rb +8 -0
- data/lib/tr8n_core/ext/date.rb +8 -0
- data/lib/tr8n_core/ext/fixnum.rb +8 -0
- data/lib/tr8n_core/ext/hash.rb +8 -0
- data/lib/tr8n_core/ext/string.rb +8 -0
- data/lib/tr8n_core/ext/time.rb +8 -0
- data/lib/tr8n_core/generators/cache/base.rb +8 -0
- data/lib/tr8n_core/generators/cache/cdb.rb +8 -0
- data/lib/tr8n_core/generators/cache/file.rb +8 -0
- data/lib/tr8n_core/version.rb +9 -2
- data/lib/tr8n_core.rb +9 -0
- data/spec/application_spec.rb +2 -2
- data/spec/cache/adapters/file_spec.rb +1 -1
- data/spec/cache/generators/file_generator_spec.rb +9 -9
- data/spec/config_spec.rb +3 -3
- data/spec/decorator_spec.rb +2 -0
- data/spec/ext/array_spec.rb +1 -1
- data/spec/ext/hash_spec.rb +1 -1
- data/spec/ext/string_spec.rb +1 -1
- data/spec/language_case_rule_spec.rb +8 -8
- data/spec/language_context_rule_spec.rb +16 -14
- data/spec/language_context_spec.rb +10 -8
- data/spec/language_spec.rb +1 -1
- data/spec/rules_engine/evaluator_spec.rb +52 -50
- data/spec/rules_engine/parser_spec.rb +2 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/tokens/hidden_spec.rb +1 -1
- data/spec/tokens/method_spec.rb +4 -4
- data/spec/tokens/transform_spec.rb +4 -4
- data/spec/translation_key_spec.rb +1 -1
- data/spec/translation_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c63616cd107057912d9e4751712da3a7b57f1d52
|
4
|
+
data.tar.gz: 39d042996c73c584256c6d68977e8ef05fb938ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44f82a0d70a1dace61537bd714b77cdeabe30ca5eea5720753607de6218a1095d0e3642d6c31beb0dd607c6e87a503b1a7ab3d0c66cbd76ad57e76f07b36ba0a
|
7
|
+
data.tar.gz: 6d470e0719c0524271f14ab2e178a83e75dcbf65f45c10701fe7ed5350e227d505f59cbe4e0af3724bf4855a74cde3135c183675a843f9101626fa672e81481e
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Tr8n Core Library For Ruby
|
6
6
|
==================
|
7
7
|
[](https://travis-ci.org/tr8n/tr8n_ruby_core)
|
8
|
-
[](https://coveralls.io/r/tr8n/tr8n_ruby_core)
|
8
|
+
[](https://coveralls.io/r/tr8n/tr8n_ruby_core?branch=master)
|
9
9
|
[](http://badge.fury.io/rb/tr8n_core)
|
10
10
|
[](https://www.versioneye.com/user/projects/52e36cc8ec1375c6f4000078)
|
11
11
|
[](http://stillmaintained.com/tr8n/tr8n_ruby_core.png)
|
@@ -35,6 +35,15 @@ gem install tr8n_core
|
|
35
35
|
```
|
36
36
|
|
37
37
|
|
38
|
+
Registering Your App
|
39
|
+
===================================
|
40
|
+
|
41
|
+
Before you can proceed with the integration, please register with https://translationexchange.com and create a new application.
|
42
|
+
|
43
|
+
At the end of the registration process you will be given a key and a secret. You will need to enter them in the initialization function of the Tr8n SDK.
|
44
|
+
|
45
|
+
|
46
|
+
|
38
47
|
Usage
|
39
48
|
==================
|
40
49
|
|
@@ -234,4 +243,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
234
243
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
235
244
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
236
245
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
237
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
246
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/tr8n/api_client.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/application.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/base.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/cache.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -22,6 +30,7 @@
|
|
22
30
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
31
|
#++
|
24
32
|
|
33
|
+
|
25
34
|
require 'redis' if defined?(::Redis)
|
26
35
|
|
27
36
|
class Tr8n::CacheAdapters::Redis < Tr8n::Cache
|
data/lib/tr8n/component.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/config.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/decorators/base.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/decorators/html.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/exception.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/language.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/language_case.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -22,7 +30,6 @@
|
|
22
30
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
31
|
#++
|
24
32
|
|
25
|
-
|
26
33
|
class Tr8n::LanguageContext < Tr8n::Base
|
27
34
|
belongs_to :language
|
28
35
|
attributes :keyword, :description, :default_key, :token_expression, :variables, :token_mapping
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/logger.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/session.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/source.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
data/lib/tr8n/tokens/data.rb
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -134,7 +142,7 @@ module Tr8n
|
|
134
142
|
#
|
135
143
|
#
|
136
144
|
##############################################################################
|
137
|
-
def
|
145
|
+
def token_values_from_array(params, language, options)
|
138
146
|
list_options = {
|
139
147
|
:description => "List joiner",
|
140
148
|
:limit => 4,
|
@@ -180,10 +188,11 @@ module Tr8n
|
|
180
188
|
end
|
181
189
|
|
182
190
|
return values.first if objects.size == 1
|
183
|
-
return values.join(list_options[:separator])
|
191
|
+
return values.join(list_options[:separator]) if list_options[:joiner].nil? || list_options[:joiner] == ""
|
184
192
|
|
193
|
+
joiner = language.translate(list_options[:joiner], list_options[:description], {}, options)
|
185
194
|
if values.size <= list_options[:limit]
|
186
|
-
return "#{values[0..-2].join(list_options[:separator])} #{
|
195
|
+
return "#{values[0..-2].join(list_options[:separator])} #{joiner} #{values.last}"
|
187
196
|
end
|
188
197
|
|
189
198
|
display_ary = values[0..(list_options[:limit]-1)]
|
@@ -191,7 +200,7 @@ module Tr8n
|
|
191
200
|
result = "#{display_ary.join(list_options[:separator])}"
|
192
201
|
|
193
202
|
unless list_options[:expandable]
|
194
|
-
result << " " <<
|
203
|
+
result << " " << joiner << " "
|
195
204
|
if list_options[:remainder] and list_options[:remainder].is_a?(Proc)
|
196
205
|
result << list_options[:remainder].call(remaining_ary)
|
197
206
|
else
|
@@ -200,11 +209,8 @@ module Tr8n
|
|
200
209
|
return result
|
201
210
|
end
|
202
211
|
|
203
|
-
joiner = language.translate(list_options[:joiner], list_options[:description], {}, options)
|
204
|
-
|
205
212
|
uniq_id = Tr8n::TranslationKey.generate_key(label, values.join(","))
|
206
|
-
result << "<span id=\"tr8n_other_link_#{uniq_id}\">"
|
207
|
-
result << " #{joiner} "
|
213
|
+
result << "<span id=\"tr8n_other_link_#{uniq_id}\"> #{joiner} "
|
208
214
|
|
209
215
|
result << "<a href='#' onClick=\"Tr8n.Utils.Effects.hide('tr8n_other_link_#{uniq_id}'); Tr8n.Utils.Effects.show('tr8n_other_elements_#{uniq_id}'); return false;\">"
|
210
216
|
if list_options[:remainder] and list_options[:remainder].is_a?(Proc)
|
@@ -243,7 +249,7 @@ module Tr8n
|
|
243
249
|
#
|
244
250
|
##############################################################################
|
245
251
|
|
246
|
-
def
|
252
|
+
def token_value_from_array_param(array, language, options)
|
247
253
|
# if you provided an array, it better have some values
|
248
254
|
if array.size < 2
|
249
255
|
Tr8n.logger.error("Invalid value for array token #{full_name} in #{label}")
|
@@ -252,14 +258,14 @@ module Tr8n
|
|
252
258
|
|
253
259
|
# if the first value of an array is an array handle it here
|
254
260
|
if array[0].is_a?(Array)
|
255
|
-
return
|
261
|
+
return token_values_from_array(array, language, options)
|
256
262
|
end
|
257
263
|
|
258
264
|
if array[1].is_a?(String)
|
259
265
|
return sanitize(array[1], array[0], language, options.merge(:safe => true))
|
260
266
|
end
|
261
267
|
|
262
|
-
if array[
|
268
|
+
if array[0].is_a?(Hash)
|
263
269
|
if array[1].is_a?(Symbol)
|
264
270
|
return sanitize(Tr8n::Utils.hash_value(array[0], array[1]), array[0], language, options.merge(:safe => false))
|
265
271
|
end
|
@@ -293,7 +299,7 @@ module Tr8n
|
|
293
299
|
#
|
294
300
|
##############################################################################
|
295
301
|
|
296
|
-
def
|
302
|
+
def token_value_from_hash_param(hash, language, options)
|
297
303
|
value = Tr8n::Utils.hash_value(hash, :value)
|
298
304
|
object = Tr8n::Utils.hash_value(hash, :object)
|
299
305
|
|
@@ -322,8 +328,8 @@ module Tr8n
|
|
322
328
|
|
323
329
|
# evaluate all possible methods for the token value and return sanitized result
|
324
330
|
def token_value(object, language, options = {})
|
325
|
-
return
|
326
|
-
return
|
331
|
+
return token_value_from_array_param(object, language, options) if object.is_a?(Array)
|
332
|
+
return token_value_from_hash_param(object, language, options) if object.is_a?(Hash)
|
327
333
|
sanitize(object, object, language, options)
|
328
334
|
end
|
329
335
|
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#--
|
3
3
|
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
4
4
|
#
|
5
|
+
# _______ _ _ _ ______ _
|
6
|
+
# |__ __| | | | | (_) | ____| | |
|
7
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
8
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
9
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
10
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
11
|
+
# __/ |
|
12
|
+
# |___/
|
5
13
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
14
|
# a copy of this software and associated documentation files (the
|
7
15
|
# "Software"), to deal in the Software without restriction, including
|
@@ -121,36 +129,17 @@ module Tr8n
|
|
121
129
|
end
|
122
130
|
|
123
131
|
default_decoration = default_decoration.clone
|
124
|
-
decoration_token_values = context[token_name.to_sym] || context[token_name.to_s]
|
132
|
+
decoration_token_values = context[token_name.to_sym] || context[token_name.to_s]
|
125
133
|
|
126
|
-
|
127
|
-
params = [token_value, decoration_token_values].flatten
|
128
|
-
params.each_with_index do |param, index|
|
129
|
-
default_decoration.gsub!("{$#{index}}", param.to_s)
|
130
|
-
end
|
131
|
-
|
132
|
-
# clean all the rest of the {$num} params, if any
|
133
|
-
param_index = params.size
|
134
|
-
while default_decoration.index("{$#{param_index}}")
|
135
|
-
default_decoration.gsub!("{$#{param_index}}", "")
|
136
|
-
param_index += 1
|
137
|
-
end
|
138
|
-
|
139
|
-
return default_decoration
|
140
|
-
end
|
134
|
+
default_decoration.gsub!("{$0}", token_value.to_s)
|
141
135
|
|
142
136
|
if decoration_token_values.is_a?(Hash)
|
143
|
-
default_decoration.gsub!("{$0}", token_value.to_s)
|
144
|
-
|
145
137
|
decoration_token_values.keys.each do |key|
|
146
138
|
default_decoration.gsub!("{$#{key}}", decoration_token_values[key].to_s)
|
147
139
|
end
|
148
|
-
|
149
|
-
return default_decoration
|
150
140
|
end
|
151
141
|
|
152
|
-
|
153
|
-
token_value
|
142
|
+
default_decoration
|
154
143
|
end
|
155
144
|
|
156
145
|
def allowed_token?(token)
|