numbers_and_words 0.11.5 → 0.11.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +5 -5
  2. data/README.rdoc +1 -3
  3. data/lib/numbers_and_words.rb +2 -0
  4. data/lib/numbers_and_words/core_ext.rb +2 -0
  5. data/lib/numbers_and_words/core_ext/array.rb +2 -0
  6. data/lib/numbers_and_words/core_ext/float.rb +2 -0
  7. data/lib/numbers_and_words/core_ext/integer.rb +2 -0
  8. data/lib/numbers_and_words/helper_classes.rb +2 -0
  9. data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
  10. data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -0
  11. data/lib/numbers_and_words/helper_classes/words_array.rb +2 -0
  12. data/lib/numbers_and_words/i18n.rb +2 -0
  13. data/lib/numbers_and_words/i18n/initialization.rb +2 -0
  14. data/lib/numbers_and_words/i18n/pluralization.rb +2 -0
  15. data/lib/numbers_and_words/i18n/plurals/cs.rb +2 -0
  16. data/lib/numbers_and_words/i18n/plurals/fr.rb +2 -0
  17. data/lib/numbers_and_words/i18n/plurals/lt.rb +2 -0
  18. data/lib/numbers_and_words/i18n/plurals/lv.rb +2 -0
  19. data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
  20. data/lib/numbers_and_words/i18n/plurals/ru.rb +2 -0
  21. data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
  22. data/lib/numbers_and_words/strategies.rb +2 -0
  23. data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
  24. data/lib/numbers_and_words/strategies/array_joiner/languages.rb +2 -0
  25. data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
  26. data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
  27. data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +2 -0
  28. data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
  29. data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
  30. data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +2 -0
  31. data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
  32. data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
  33. data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
  34. data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
  35. data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
  36. data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +2 -0
  37. data/lib/numbers_and_words/strategies/figures_converter.rb +2 -0
  38. data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +2 -0
  39. data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
  40. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
  41. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
  42. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
  43. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
  44. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
  45. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
  46. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
  47. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
  48. data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
  49. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
  50. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
  51. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
  52. data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
  53. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
  54. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
  55. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
  56. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
  57. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
  58. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
  59. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
  60. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
  61. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
  62. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +2 -0
  63. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
  64. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
  65. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
  66. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
  67. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
  68. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
  69. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
  70. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
  71. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
  72. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
  73. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
  74. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
  75. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
  76. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +2 -0
  77. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +2 -0
  78. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +2 -0
  79. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +2 -0
  80. data/lib/numbers_and_words/strategies/figures_converter/languages.rb +2 -0
  81. data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +2 -0
  82. data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +2 -0
  83. data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +2 -0
  84. data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
  85. data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -7
  86. data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -11
  87. data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -0
  88. data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
  89. data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
  90. data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
  91. data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +2 -0
  92. data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -0
  93. data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +2 -0
  94. data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -0
  95. data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +2 -0
  96. data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +2 -0
  97. data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +2 -0
  98. data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -3
  99. data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +9 -3
  100. data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +2 -0
  101. data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
  102. data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -0
  103. data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +2 -0
  104. data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
  105. data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +4 -0
  106. data/lib/numbers_and_words/strategies/figures_converter/options.rb +14 -1
  107. data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
  108. data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
  109. data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
  110. data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
  111. data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
  112. data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
  113. data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
  114. data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
  115. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
  116. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
  117. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
  118. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
  119. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
  120. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
  121. data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
  122. data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
  123. data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +3 -10
  124. data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
  125. data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
  126. data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
  127. data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
  128. data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
  129. data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
  130. data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
  131. data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
  132. data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
  133. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
  134. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
  135. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
  136. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
  137. data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
  138. data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
  139. data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
  140. data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
  141. data/lib/numbers_and_words/translations.rb +2 -0
  142. data/lib/numbers_and_words/translations/base.rb +2 -0
  143. data/lib/numbers_and_words/translations/cs.rb +2 -0
  144. data/lib/numbers_and_words/translations/de.rb +2 -0
  145. data/lib/numbers_and_words/translations/en-GB.rb +2 -0
  146. data/lib/numbers_and_words/translations/en.rb +2 -0
  147. data/lib/numbers_and_words/translations/es.rb +10 -5
  148. data/lib/numbers_and_words/translations/et.rb +2 -0
  149. data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +2 -0
  150. data/lib/numbers_and_words/translations/families/base.rb +2 -0
  151. data/lib/numbers_and_words/translations/families/cyrillic.rb +2 -0
  152. data/lib/numbers_and_words/translations/families/latin.rb +2 -0
  153. data/lib/numbers_and_words/translations/fr.rb +9 -7
  154. data/lib/numbers_and_words/translations/hu.rb +2 -0
  155. data/lib/numbers_and_words/translations/hy.rb +2 -0
  156. data/lib/numbers_and_words/translations/it.rb +2 -0
  157. data/lib/numbers_and_words/translations/ka.rb +3 -1
  158. data/lib/numbers_and_words/translations/lt.rb +2 -0
  159. data/lib/numbers_and_words/translations/lv.rb +2 -0
  160. data/lib/numbers_and_words/translations/nl.rb +3 -0
  161. data/lib/numbers_and_words/translations/pt-BR.rb +9 -2
  162. data/lib/numbers_and_words/translations/pt.rb +3 -0
  163. data/lib/numbers_and_words/translations/ru.rb +2 -0
  164. data/lib/numbers_and_words/translations/se.rb +2 -0
  165. data/lib/numbers_and_words/translations/tr.rb +2 -0
  166. data/lib/numbers_and_words/translations/ua.rb +2 -0
  167. data/lib/numbers_and_words/translations/vi.rb +5 -2
  168. data/lib/numbers_and_words/version.rb +3 -1
  169. data/lib/numbers_and_words/wrappers.rb +2 -0
  170. data/lib/numbers_and_words/wrappers/float.rb +3 -1
  171. data/lib/numbers_and_words/wrappers/integer.rb +2 -0
  172. metadata +7 -4
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class PtBr < Base
@@ -14,6 +16,7 @@ module NumbersAndWords
14
16
 
15
17
  def ones(number, options = {})
16
18
  return if options[:is_one_thousand]
19
+
17
20
  t([options[:prefix], :ones, options[:gender]].join('.'))[number]
18
21
  end
19
22
 
@@ -24,25 +27,29 @@ module NumbersAndWords
24
27
  end
25
28
 
26
29
  def teens(number, options = {})
27
- return [tens(1, options), ' ', ones(number[0], options)].join if ordinal? options
30
+ return [tens(1, options), ones(number[0], options)].join(' ') if ordinal? options
31
+
28
32
  super(number, options)
29
33
  end
30
34
 
31
35
  def tens_with_ones(numbers, options = {})
32
36
  connector = ordinal?(options) ? ' ' : " #{union} "
33
- [tens(numbers[1], options), connector, ones(numbers[0], options)].join
37
+ [tens(numbers[1], options), ones(numbers[0], options)].join(connector)
34
38
  end
35
39
 
36
40
  def hundreds(number, options = {})
37
41
  return t(:one_hundred) if options[:is_one_hundred] && !ordinal?(options)
42
+
38
43
  hundreds = t([options[:prefix], :hundreds, options[:gender]].join('.'))[number]
39
44
  return hundreds if ordinal?(options) || options[:is_hundred]
45
+
40
46
  [hundreds, union].join(' ')
41
47
  end
42
48
 
43
49
  def megs(capacity, options = {})
44
50
  return t([options[:prefix], :mega, options[:gender]].join('.'))[capacity] if ordinal?(options)
45
51
  return super(capacity, options) if options[:is_opaque] || options[:is_without_connector]
52
+
46
53
  suffix = options[:is_with_comma] ? ',' : " #{union}"
47
54
  super(capacity, options) + suffix
48
55
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Pt < Base
@@ -10,6 +12,7 @@ module NumbersAndWords
10
12
  def hundreds(number, options = {})
11
13
  return t(:one_hundred) if options[:is_one_hundred]
12
14
  return t(:hundreds)[number] if options[:is_hundred]
15
+
13
16
  [t(:hundreds)[number], union].join(' ')
14
17
  end
15
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Ru < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Se < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Tr < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Ua < Base
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Translations
3
5
  class Vi < Base
4
6
  include NumbersAndWords::Translations::Families::Latin
5
7
  include NumbersAndWords::Translations::Extensions::FractionSignificance
6
8
  def ones_of_tens(number, options = {})
7
- return t(%i[units tens one].join('.')) if number == 1
8
- return t(%i[units tens five].join('.')) if number == 5
9
+ return t('units.tens.one') if number == 1
10
+ return t('units.tens.five') if number == 5
11
+
9
12
  ones(number, options)
10
13
  end
11
14
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
- VERSION = '0.11.5'.freeze
4
+ VERSION = '0.11.6'
3
5
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/wrappers/integer'
2
4
  require 'numbers_and_words/wrappers/float'
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Wrappers
3
5
  class Float
4
- ZERO_SYMBOL = '0'.freeze
6
+ ZERO_SYMBOL = '0'
5
7
 
6
8
  attr_accessor :number
7
9
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Wrappers
3
5
  class Integer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numbers_and_words
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Lazarev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2019-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -187,6 +187,10 @@ files:
187
187
  - lib/numbers_and_words/strategies/figures_converter/languages/ua.rb
188
188
  - lib/numbers_and_words/strategies/figures_converter/languages/vi.rb
189
189
  - lib/numbers_and_words/strategies/figures_converter/options.rb
190
+ - lib/numbers_and_words/strategies/figures_converter/options/base.rb
191
+ - lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb
192
+ - lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb
193
+ - lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb
190
194
  - lib/numbers_and_words/strategies/figures_converter/options/cs.rb
191
195
  - lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb
192
196
  - lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb
@@ -267,8 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
271
  - !ruby/object:Gem::Version
268
272
  version: '0'
269
273
  requirements: []
270
- rubyforge_project:
271
- rubygems_version: 2.6.14
274
+ rubygems_version: 3.0.3
272
275
  signing_key:
273
276
  specification_version: 4
274
277
  summary: Convert numbers to words using I18N.