tr8n_core 4.0.6 → 4.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -2
  3. data/lib/tr8n/api_client.rb +8 -0
  4. data/lib/tr8n/application.rb +8 -0
  5. data/lib/tr8n/base.rb +8 -0
  6. data/lib/tr8n/cache.rb +8 -0
  7. data/lib/tr8n/cache_adapters/cdb.rb +8 -0
  8. data/lib/tr8n/cache_adapters/file.rb +8 -0
  9. data/lib/tr8n/cache_adapters/memcache.rb +8 -0
  10. data/lib/tr8n/cache_adapters/redis.rb +9 -0
  11. data/lib/tr8n/component.rb +8 -0
  12. data/lib/tr8n/config.rb +8 -0
  13. data/lib/tr8n/decorators/base.rb +8 -0
  14. data/lib/tr8n/decorators/default.rb +8 -0
  15. data/lib/tr8n/decorators/html.rb +8 -0
  16. data/lib/tr8n/exception.rb +8 -0
  17. data/lib/tr8n/language.rb +8 -0
  18. data/lib/tr8n/language_case.rb +8 -0
  19. data/lib/tr8n/language_case_rule.rb +8 -0
  20. data/lib/tr8n/language_context.rb +8 -1
  21. data/lib/tr8n/language_context_rule.rb +8 -0
  22. data/lib/tr8n/logger.rb +8 -0
  23. data/lib/tr8n/rules_engine/evaluator.rb +8 -0
  24. data/lib/tr8n/rules_engine/parser.rb +8 -0
  25. data/lib/tr8n/session.rb +8 -0
  26. data/lib/tr8n/source.rb +8 -0
  27. data/lib/tr8n/tokens/data.rb +20 -14
  28. data/lib/tr8n/tokens/data_tokenizer.rb +8 -0
  29. data/lib/tr8n/tokens/decoration_tokenizer.rb +11 -22
  30. data/lib/tr8n/tokens/hidden.rb +8 -0
  31. data/lib/tr8n/tokens/method.rb +8 -0
  32. data/lib/tr8n/tokens/transform.rb +8 -0
  33. data/lib/tr8n/translation.rb +8 -0
  34. data/lib/tr8n/translation_key.rb +8 -0
  35. data/lib/tr8n/translator.rb +8 -0
  36. data/lib/tr8n/utils.rb +8 -0
  37. data/lib/tr8n_core/ext/array.rb +8 -0
  38. data/lib/tr8n_core/ext/date.rb +8 -0
  39. data/lib/tr8n_core/ext/fixnum.rb +8 -0
  40. data/lib/tr8n_core/ext/hash.rb +8 -0
  41. data/lib/tr8n_core/ext/string.rb +8 -0
  42. data/lib/tr8n_core/ext/time.rb +8 -0
  43. data/lib/tr8n_core/generators/cache/base.rb +8 -0
  44. data/lib/tr8n_core/generators/cache/cdb.rb +8 -0
  45. data/lib/tr8n_core/generators/cache/file.rb +8 -0
  46. data/lib/tr8n_core/version.rb +9 -2
  47. data/lib/tr8n_core.rb +9 -0
  48. data/spec/application_spec.rb +2 -2
  49. data/spec/cache/adapters/file_spec.rb +1 -1
  50. data/spec/cache/generators/file_generator_spec.rb +9 -9
  51. data/spec/config_spec.rb +3 -3
  52. data/spec/decorator_spec.rb +2 -0
  53. data/spec/ext/array_spec.rb +1 -1
  54. data/spec/ext/hash_spec.rb +1 -1
  55. data/spec/ext/string_spec.rb +1 -1
  56. data/spec/language_case_rule_spec.rb +8 -8
  57. data/spec/language_context_rule_spec.rb +16 -14
  58. data/spec/language_context_spec.rb +10 -8
  59. data/spec/language_spec.rb +1 -1
  60. data/spec/rules_engine/evaluator_spec.rb +52 -50
  61. data/spec/rules_engine/parser_spec.rb +2 -0
  62. data/spec/spec_helper.rb +7 -0
  63. data/spec/tokens/hidden_spec.rb +1 -1
  64. data/spec/tokens/method_spec.rb +4 -4
  65. data/spec/tokens/transform_spec.rb +4 -4
  66. data/spec/translation_key_spec.rb +1 -1
  67. data/spec/translation_spec.rb +1 -1
  68. metadata +3 -3
@@ -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
@@ -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/utils.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
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -1,6 +1,14 @@
1
1
  #--
2
2
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
3
  #
4
+ # _______ _ _ _ ______ _
5
+ # |__ __| | | | | (_) | ____| | |
6
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
+ # __/ |
11
+ # |___/
4
12
  # Permission is hereby granted, free of charge, to any person obtaining
5
13
  # a copy of this software and associated documentation files (the
6
14
  # "Software"), to deal in the Software without restriction, including
@@ -21,7 +29,6 @@
21
29
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
30
  #++
23
31
 
24
-
25
32
  module Tr8nCore
26
- VERSION = "4.0.6"
33
+ VERSION = "4.0.7"
27
34
  end
data/lib/tr8n_core.rb CHANGED
@@ -1,6 +1,15 @@
1
+ # encoding: UTF-8
1
2
  #--
2
3
  # Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
3
4
  #
5
+ # _______ _ _ _ ______ _
6
+ # |__ __| | | | | (_) | ____| | |
7
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
8
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
9
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
10
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
11
+ # __/ |
12
+ # |___/
4
13
  # Permission is hereby granted, free of charge, to any person obtaining
5
14
  # a copy of this software and associated documentation files (the
6
15
  # "Software"), to deal in the Software without restriction, including
@@ -24,8 +24,8 @@ describe Tr8n::Application do
24
24
  expect(@app.default_data_token('nbsp')).to eq("&nbsp;")
25
25
  expect(@app.default_decoration_token('strong')).to eq("<strong>{$0}</strong>")
26
26
 
27
- expect(@app.feature_enabled?(:language_cases)).to be_true
28
- expect(@app.feature_enabled?(:language_flags)).to be_true
27
+ expect(@app.feature_enabled?(:language_cases)).to be_truthy
28
+ expect(@app.feature_enabled?(:language_flags)).to be_truthy
29
29
  end
30
30
 
31
31
  it "loads application language" do
@@ -24,7 +24,7 @@ describe Tr8n::CacheAdapters::File do
24
24
  c.delete("a")
25
25
  c.clear()
26
26
 
27
- expect(c.exist?("some_new_key")).to be_false
27
+ expect(c.exist?("some_new_key")).to be_falsey
28
28
  end
29
29
 
30
30
  end
@@ -13,15 +13,15 @@ describe Tr8nCore::Generators::Cache::File do
13
13
  :path => "./cache"
14
14
  }
15
15
 
16
- g = Tr8nCore::Generators::Cache::File.new
17
- g.started_at = Time.new(2014, 01, 01, 10, 11, 12)
18
- expect(g.cache_path).to eq("./cache/files/tr8n_default_2014_01_01_10_11_12")
19
- expect(g.symlink_path).to eq("./cache/files/current")
20
-
21
- expect(g.file_path("test_key")).to eq("./cache/files/tr8n_default_2014_01_01_10_11_12/test_key.json")
22
-
23
- g.cache("test_key", {"a" => "b"})
24
- expect(File.exists?(g.file_path("test_key"))).to be_true
16
+ #g = Tr8nCore::Generators::Cache::File.new
17
+ #g.started_at = Time.new(2014, 01, 01, 10, 11, 12)
18
+ #expect(g.cache_path).to eq("./cache/files/tr8n_default_2014_01_01_10_11_12")
19
+ #expect(g.symlink_path).to eq("./cache/files/current")
20
+ #
21
+ #expect(g.file_path("test_key")).to eq("./cache/files/tr8n_default_2014_01_01_10_11_12/test_key.json")
22
+ #
23
+ #g.cache("test_key", {"a" => "b"})
24
+ #expect(File.exists?(g.file_path("test_key"))).to be_truthy
25
25
 
26
26
  end
27
27
 
data/spec/config_spec.rb CHANGED
@@ -5,10 +5,10 @@ require 'spec_helper'
5
5
  describe Tr8n::Config do
6
6
  describe "loading defaults" do
7
7
  it "should load correct values" do
8
- expect(Tr8n.config.logger[:enabled]).to be_false
9
- expect(Tr8n.config.enabled?).to be_true
8
+ expect(Tr8n.config.logger[:enabled]).to be_falsey
9
+ expect(Tr8n.config.enabled?).to be_truthy
10
10
  expect(Tr8n.config.default_locale).to eq("en-US")
11
- expect(Tr8n.config.cache[:enabled]).to be_false
11
+ expect(Tr8n.config.cache[:enabled]).to be_falsey
12
12
  expect(Tr8n.config.logger[:path]).to eq("./log/tr8n.log")
13
13
  expect(Tr8n.config.cache[:adapter]).to eq("memcache")
14
14
  end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Tr8n::Decorators::Default do
@@ -7,6 +7,6 @@ describe Array do
7
7
  expect([].tr8n_translated?).to be_nil
8
8
 
9
9
  a = [].tr8n_translated
10
- expect(a.tr8n_translated?).to be_true
10
+ expect(a.tr8n_translated?).to be_truthy
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  describe Hash do
6
6
  it "must provide correct attributes" do
7
7
  h = {}.tr8n_translated
8
- expect(h.tr8n_translated?).to be_true
8
+ expect(h.tr8n_translated?).to be_truthy
9
9
 
10
10
  h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
11
11
  h2 = {"b" => 254, "c" => 300, "c" => {"c1" => 16, "c3" => 94}}
@@ -5,6 +5,6 @@ require 'spec_helper'
5
5
  describe String do
6
6
  it "must provide correct attributes" do
7
7
  s = "".tr8n_translated
8
- expect(s.tr8n_translated?).to be_true
8
+ expect(s.tr8n_translated?).to be_truthy
9
9
  end
10
10
  end
@@ -16,10 +16,10 @@ describe Tr8n::LanguageCaseRule do
16
16
  :operations => "(append \"'\" @value)"
17
17
  )
18
18
 
19
- expect(@rule.evaluate("Michael")).to be_false
20
- expect(@rule.evaluate("Anna")).to be_false
19
+ expect(@rule.evaluate("Michael")).to be_falsey
20
+ expect(@rule.evaluate("Anna")).to be_falsey
21
21
 
22
- expect(@rule.evaluate("friends")).to be_true
22
+ expect(@rule.evaluate("friends")).to be_truthy
23
23
  expect(@rule.apply("friends")).to eq("friends'")
24
24
 
25
25
  @rule = Tr8n::LanguageCaseRule.new(
@@ -27,21 +27,21 @@ describe Tr8n::LanguageCaseRule do
27
27
  :operations => "(append \"'s\" @value)"
28
28
  )
29
29
 
30
- expect(@rule.evaluate("Michael")).to be_true
30
+ expect(@rule.evaluate("Michael")).to be_truthy
31
31
  expect(@rule.apply("Michael")).to eq("Michael's")
32
32
 
33
- expect(@rule.evaluate("Anna")).to be_true
33
+ expect(@rule.evaluate("Anna")).to be_truthy
34
34
  expect(@rule.apply("Anna")).to eq("Anna's")
35
35
 
36
- expect(@rule.evaluate("friends")).to be_false
36
+ expect(@rule.evaluate("friends")).to be_falsey
37
37
 
38
38
  @rule = Tr8n::LanguageCaseRule.new(
39
39
  :conditions => "(= '1' @value))",
40
40
  :operations => "(quote 'first')"
41
41
  )
42
42
 
43
- expect(@rule.evaluate('2')).to be_false
44
- expect(@rule.evaluate('1')).to be_true
43
+ expect(@rule.evaluate('2')).to be_falsey
44
+ expect(@rule.evaluate('1')).to be_truthy
45
45
  expect(@rule.apply('1')).to eq("first")
46
46
 
47
47
  @rule = Tr8n::LanguageCaseRule.new(
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Tr8n::LanguageContextRule do
@@ -11,20 +13,20 @@ describe Tr8n::LanguageContextRule do
11
13
  describe "finding fallback rules" do
12
14
  it "should return fallback rule" do
13
15
  rule = Tr8n::LanguageContextRule.new(:keyword => "one", :conditions => "(= 1 @n)", :examples => "1")
14
- expect(rule.fallback?).to be_false
16
+ expect(rule.fallback?).to be_falsey
15
17
 
16
18
  rule = Tr8n::LanguageContextRule.new(:keyword => "other", :examples => "0, 2-999; 1.2, 2.07...")
17
- expect(rule.fallback?).to be_true
19
+ expect(rule.fallback?).to be_truthy
18
20
  end
19
21
  end
20
22
 
21
23
  describe "evaluating rules" do
22
24
  it "should return correct results" do
23
25
  rule = Tr8n::LanguageContextRule.new(:keyword => "one", :conditions => "(= 1 @n)", :examples => "1")
24
- expect(rule.evaluate).to be_false
25
- expect(rule.evaluate({"@n" => 1})).to be_true
26
- expect(rule.evaluate({"@n" => 2})).to be_false
27
- expect(rule.evaluate({"@n" => 0})).to be_false
26
+ expect(rule.evaluate).to be_falsey
27
+ expect(rule.evaluate({"@n" => 1})).to be_truthy
28
+ expect(rule.evaluate({"@n" => 2})).to be_falsey
29
+ expect(rule.evaluate({"@n" => 0})).to be_falsey
28
30
 
29
31
  one = Tr8n::LanguageContextRule.new(:keyword => "one", :conditions => "(&& (= 1 (mod @n 10)) (!= 11 (mod @n 100)))", :description => "{n} mod 10 is 1 and {n} mod 100 is not 11", :examples => "1, 21, 31, 41, 51, 61...")
30
32
  few = Tr8n::LanguageContextRule.new(:keyword => "few", :conditions => "(&& (in '2..4' (mod @n 10)) (not (in '12..14' (mod @n 100))))", :description => "{n} mod 10 in 2..4 and {n} mod 100 not in 12..14", :examples => "2-4, 22-24, 32-34...")
@@ -37,7 +39,7 @@ describe Tr8n::LanguageContextRule do
37
39
  }.each do |vals, rule|
38
40
  vals.each do |val|
39
41
  vars = {"@n" => val}
40
- expect(rule.evaluate(vars)).to be_true
42
+ expect(rule.evaluate(vars)).to be_truthy
41
43
  end
42
44
  end
43
45
 
@@ -48,7 +50,7 @@ describe Tr8n::LanguageContextRule do
48
50
  }.each do |vals, rule|
49
51
  vals.each do |val|
50
52
  vars = {"@n" => val}
51
- expect(rule.evaluate(vars)).to be_false
53
+ expect(rule.evaluate(vars)).to be_falsey
52
54
  end
53
55
  end
54
56
 
@@ -57,16 +59,16 @@ describe Tr8n::LanguageContextRule do
57
59
  one_unknown = Tr8n::LanguageContextRule.new(:keyword => "one_unknown", :conditions => "(&& (= 1 (count @genders)) (all @genders 'unknown'))", :description => "List contains one user with unknown gender")
58
60
  many = Tr8n::LanguageContextRule.new(:keyword => "many", :conditions => "(> (count @genders) 1)", :description => "List contains two or more users")
59
61
 
60
- expect(one_male.evaluate({"@genders" => ["male"]})).to be_true
61
- expect(one_male.evaluate({"@genders" => ["male", "male"]})).to be_false
62
+ expect(one_male.evaluate({"@genders" => ["male"]})).to be_truthy
63
+ expect(one_male.evaluate({"@genders" => ["male", "male"]})).to be_falsey
62
64
 
63
- expect(one_female.evaluate({"@genders" => ["female"]})).to be_true
64
- expect(many.evaluate({"@genders" => ["female", "male"]})).to be_true
65
+ expect(one_female.evaluate({"@genders" => ["female"]})).to be_truthy
66
+ expect(many.evaluate({"@genders" => ["female", "male"]})).to be_truthy
65
67
 
66
- expect(one_unknown.evaluate({"@genders" => ["unknown"]})).to be_true
68
+ expect(one_unknown.evaluate({"@genders" => ["unknown"]})).to be_truthy
67
69
 
68
70
  many_male = Tr8n::LanguageContextRule.new(:keyword => "one", :conditions => "(&& (> (count @genders) 1) (all @genders 'male'))", :description => "List contains at least two users, all male")
69
- expect(many_male.evaluate({"@genders" => ["male", "male"]})).to be_true
71
+ expect(many_male.evaluate({"@genders" => ["male", "male"]})).to be_truthy
70
72
  end
71
73
  end
72
74
 
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Tr8n::LanguageContext do
@@ -34,14 +36,14 @@ describe Tr8n::LanguageContext do
34
36
  )
35
37
 
36
38
  expect(@context.token_expression).to eq(/.*(count|num|age|hours|minutes|years|seconds)(\d)*$/)
37
- expect(@context.applies_to_token?("num")).to be_true
38
- expect(@context.applies_to_token?("num1")).to be_true
39
- expect(@context.applies_to_token?("profile_num1")).to be_true
40
- expect(@context.applies_to_token?("profile_num21")).to be_true
41
- expect(@context.applies_to_token?("profile")).to be_false
42
- expect(@context.applies_to_token?("num_years")).to be_true
43
- expect(@context.applies_to_token?("count1")).to be_true
44
- expect(@context.applies_to_token?("count2")).to be_true
39
+ expect(@context.applies_to_token?("num")).to be_truthy
40
+ expect(@context.applies_to_token?("num1")).to be_truthy
41
+ expect(@context.applies_to_token?("profile_num1")).to be_truthy
42
+ expect(@context.applies_to_token?("profile_num21")).to be_truthy
43
+ expect(@context.applies_to_token?("profile")).to be_falsey
44
+ expect(@context.applies_to_token?("num_years")).to be_truthy
45
+ expect(@context.applies_to_token?("count1")).to be_truthy
46
+ expect(@context.applies_to_token?("count2")).to be_truthy
45
47
  end
46
48
  end
47
49
 
@@ -18,7 +18,7 @@ describe Tr8n::Language do
18
18
  expect(@russian.class.cache_key("ru")).to eq("l@_[ru]")
19
19
  expect(@russian.class.cache_prefix).to eq("l@")
20
20
 
21
- expect(@russian.has_definition?).to be_true
21
+ expect(@russian.has_definition?).to be_truthy
22
22
 
23
23
  end
24
24
  end