numbers_and_words 0.11.2 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +23 -5
- data/lib/numbers_and_words.rb +2 -0
- data/lib/numbers_and_words/core_ext.rb +2 -0
- data/lib/numbers_and_words/core_ext/array.rb +2 -0
- data/lib/numbers_and_words/core_ext/float.rb +2 -0
- data/lib/numbers_and_words/core_ext/integer.rb +2 -0
- data/lib/numbers_and_words/helper_classes.rb +2 -0
- data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
- data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -0
- data/lib/numbers_and_words/helper_classes/words_array.rb +2 -0
- data/lib/numbers_and_words/i18n.rb +2 -0
- data/lib/numbers_and_words/i18n/initialization.rb +2 -0
- data/lib/numbers_and_words/i18n/locales/numbers.cs.yml +37 -26
- data/lib/numbers_and_words/i18n/locales/numbers.de.yml +5 -4
- data/lib/numbers_and_words/i18n/locales/numbers.en-GB.yml +24 -8
- data/lib/numbers_and_words/i18n/locales/numbers.en.yml +10 -6
- data/lib/numbers_and_words/i18n/locales/numbers.es.yml +6 -5
- data/lib/numbers_and_words/i18n/locales/numbers.et.yml +4 -4
- data/lib/numbers_and_words/i18n/locales/numbers.fr.yml +45 -41
- data/lib/numbers_and_words/i18n/locales/numbers.hu.yml +11 -7
- data/lib/numbers_and_words/i18n/locales/numbers.hy.yml +7 -0
- data/lib/numbers_and_words/i18n/locales/numbers.it.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.ka.yml +6 -14
- data/lib/numbers_and_words/i18n/locales/numbers.lt.yml +4 -5
- data/lib/numbers_and_words/i18n/locales/numbers.lv.yml +4 -5
- data/lib/numbers_and_words/i18n/locales/numbers.nl.yml +4 -3
- data/lib/numbers_and_words/i18n/locales/numbers.pt-BR.yml +51 -22
- data/lib/numbers_and_words/i18n/locales/numbers.pt.yml +21 -8
- data/lib/numbers_and_words/i18n/locales/numbers.ru.yml +39 -27
- data/lib/numbers_and_words/i18n/locales/numbers.se.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.tr.yml +3 -3
- data/lib/numbers_and_words/i18n/locales/numbers.ua.yml +39 -15
- data/lib/numbers_and_words/i18n/locales/numbers.vi.yml +13 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +3 -1
- data/lib/numbers_and_words/i18n/plurals/cs.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/fr.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/lt.rb +10 -7
- data/lib/numbers_and_words/i18n/plurals/lv.rb +5 -3
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/ru.rb +15 -10
- data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
- data/lib/numbers_and_words/strategies.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages.rb +3 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +3 -1
- data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +5 -3
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +12 -0
- data/lib/numbers_and_words/strategies/figures_converter.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +14 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +14 -15
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +4 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +4 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +7 -7
- data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -9
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -13
- data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +12 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -2
- data/lib/numbers_and_words/strategies/figures_converter/languages/{families/latin.rb → hy.rb} +3 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +13 -15
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +8 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +4 -14
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -5
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +14 -12
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -1
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +4 -4
- data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +100 -0
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +15 -2
- data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +3 -10
- data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
- data/lib/numbers_and_words/translations.rb +4 -0
- data/lib/numbers_and_words/translations/base.rb +3 -1
- data/lib/numbers_and_words/translations/cs.rb +6 -31
- data/lib/numbers_and_words/translations/de.rb +5 -3
- data/lib/numbers_and_words/translations/en-GB.rb +5 -1
- data/lib/numbers_and_words/translations/en.rb +2 -0
- data/lib/numbers_and_words/translations/es.rb +15 -25
- data/lib/numbers_and_words/translations/et.rb +4 -7
- data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +6 -4
- data/lib/numbers_and_words/translations/families/base.rb +5 -3
- data/lib/numbers_and_words/translations/families/cyrillic.rb +6 -8
- data/lib/numbers_and_words/translations/families/latin.rb +2 -0
- data/lib/numbers_and_words/translations/fr.rb +15 -18
- data/lib/numbers_and_words/translations/hu.rb +4 -7
- data/lib/numbers_and_words/translations/hy.rb +21 -0
- data/lib/numbers_and_words/translations/it.rb +2 -0
- data/lib/numbers_and_words/translations/ka.rb +6 -14
- data/lib/numbers_and_words/translations/lt.rb +4 -11
- data/lib/numbers_and_words/translations/lv.rb +4 -11
- data/lib/numbers_and_words/translations/nl.rb +6 -2
- data/lib/numbers_and_words/translations/pt-BR.rb +23 -23
- data/lib/numbers_and_words/translations/pt.rb +5 -11
- data/lib/numbers_and_words/translations/ru.rb +2 -17
- data/lib/numbers_and_words/translations/se.rb +2 -0
- data/lib/numbers_and_words/translations/tr.rb +2 -4
- data/lib/numbers_and_words/translations/ua.rb +2 -13
- data/lib/numbers_and_words/translations/vi.rb +24 -0
- data/lib/numbers_and_words/version.rb +3 -1
- data/lib/numbers_and_words/wrappers.rb +2 -0
- data/lib/numbers_and_words/wrappers/float.rb +3 -1
- data/lib/numbers_and_words/wrappers/integer.rb +2 -0
- metadata +33 -20
@@ -1,16 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module FiguresConverter
|
4
6
|
module Languages
|
5
7
|
class Pt < Base
|
6
|
-
include Families::Latin
|
7
|
-
|
8
8
|
def hundreds
|
9
9
|
super({ is_hundred: hundred?, is_one_hundred: one_hundred? })
|
10
10
|
end
|
11
11
|
|
12
12
|
def megs
|
13
|
-
super({
|
13
|
+
super({ number: @figures.number_in_capacity(@current_capacity) })
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -1,12 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module FiguresConverter
|
4
6
|
module Languages
|
5
7
|
class Tr < Base
|
6
|
-
include Families::Latin
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
8
|
def capacity_iteration
|
11
9
|
words = []
|
12
10
|
capacity_words = words_in_capacity(@current_capacity)
|
@@ -15,6 +13,8 @@ module NumbersAndWords
|
|
15
13
|
words
|
16
14
|
end
|
17
15
|
|
16
|
+
private
|
17
|
+
|
18
18
|
def one?
|
19
19
|
words_in_capacity(@current_capacity) == [translations.ones(1)]
|
20
20
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Languages
|
7
|
+
class Vi < Base
|
8
|
+
def print_words
|
9
|
+
value = super
|
10
|
+
remove_billion_noice(value)
|
11
|
+
end
|
12
|
+
|
13
|
+
def strings_logic
|
14
|
+
if fractional?
|
15
|
+
if fraction_number_zeros_leading.zero?
|
16
|
+
@options.options[:integeral] = true
|
17
|
+
integeral_string_logic
|
18
|
+
else
|
19
|
+
fractional_with_zero_leading_string_logic
|
20
|
+
end
|
21
|
+
else
|
22
|
+
integeral_string_logic
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def fractional_with_zero_leading_string_logic
|
27
|
+
leading_zeros = [0] * fraction_number_zeros_leading
|
28
|
+
(@figures + leading_zeros).map(&:to_words)
|
29
|
+
end
|
30
|
+
|
31
|
+
def integeral_string_logic
|
32
|
+
if @figures.capacity_count
|
33
|
+
number_without_capacity_to_words + complex_number_to_words
|
34
|
+
elsif hundreds?
|
35
|
+
hundreds_number_to_words
|
36
|
+
elsif @figures.tens || @figures.ones
|
37
|
+
simple_number_to_words
|
38
|
+
else
|
39
|
+
[]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def hundreds?
|
44
|
+
@figures.hundreds ||
|
45
|
+
(@figures.size == 3 && (@figures.teens || @figures.tens || @figures.ones))
|
46
|
+
end
|
47
|
+
|
48
|
+
def hundreds(options = {})
|
49
|
+
if @figures.hundreds.to_i.zero?
|
50
|
+
translate :hundreds, 0, options
|
51
|
+
else
|
52
|
+
super
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def ones(options = {})
|
57
|
+
if @figures.capacity_length >= 2
|
58
|
+
ones_union(options)
|
59
|
+
else
|
60
|
+
super
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def ones_union(options = {})
|
65
|
+
translate :ones_union, @figures.ones, options
|
66
|
+
end
|
67
|
+
|
68
|
+
def fractional?
|
69
|
+
!@options.options[:fractional].nil? && !@options.options[:integeral]
|
70
|
+
end
|
71
|
+
|
72
|
+
def fraction_length
|
73
|
+
return 0 unless @options.options[:fractional]
|
74
|
+
|
75
|
+
@options.options[:fractional][:length]
|
76
|
+
end
|
77
|
+
|
78
|
+
def fraction_number_zeros_leading
|
79
|
+
fraction_length - @figures.length
|
80
|
+
end
|
81
|
+
|
82
|
+
def remove_billion_noice(value)
|
83
|
+
parts = value.split(billion_unit).map(&:strip)
|
84
|
+
if value.end_with?(billion_unit)
|
85
|
+
parts.insert(-1, billion_unit).join(' ')
|
86
|
+
else
|
87
|
+
return value if parts.size <= 2
|
88
|
+
|
89
|
+
parts.insert(-2, billion_unit).join(' ')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def billion_unit
|
94
|
+
translate :mega, 3
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'numbers_and_words/strategies/figures_converter/options/base'
|
1
4
|
require 'numbers_and_words/strategies/figures_converter/options/en'
|
2
5
|
require 'numbers_and_words/strategies/figures_converter/options/en-GB'
|
3
6
|
require 'numbers_and_words/strategies/figures_converter/options/es'
|
@@ -20,9 +23,19 @@ module NumbersAndWords
|
|
20
23
|
end
|
21
24
|
|
22
25
|
def method_missing(method_name, *args, &block)
|
23
|
-
Object.const_get(proxy_class_name(method_name))
|
26
|
+
method = Object.const_get(proxy_class_name(method_name))
|
27
|
+
|
28
|
+
if method
|
29
|
+
method.new(self, args, block)
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
24
33
|
rescue NameError
|
25
|
-
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def respond_to_missing?(method_name, include_private = false)
|
38
|
+
Object.const_get(proxy_class_name(method_name)) || super
|
26
39
|
end
|
27
40
|
|
28
41
|
private
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'numbers_and_words/strategies/figures_converter/options/base/gender'
|
4
|
+
require 'numbers_and_words/strategies/figures_converter/options/base/ordinal'
|
5
|
+
require 'numbers_and_words/strategies/figures_converter/options/base/remove_zero'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Options
|
7
|
+
module Base
|
8
|
+
class Gender
|
9
|
+
attr_accessor :strategy, :options
|
10
|
+
|
11
|
+
def initialize(proxy, *_args)
|
12
|
+
@strategy = proxy.strategy
|
13
|
+
@options = proxy.options
|
14
|
+
end
|
15
|
+
|
16
|
+
def result
|
17
|
+
active? ? @options[:gender].to_sym : :male
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def active?
|
23
|
+
@options[:gender]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Options
|
7
|
+
module Base
|
8
|
+
class Ordinal
|
9
|
+
def initialize(proxy, *_args)
|
10
|
+
@strategy = proxy.strategy
|
11
|
+
@options = proxy.options
|
12
|
+
end
|
13
|
+
|
14
|
+
def result
|
15
|
+
return :ordinal if active?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def active?
|
21
|
+
@options[:ordinal]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NumbersAndWords
|
4
|
+
module Strategies
|
5
|
+
module FiguresConverter
|
6
|
+
module Options
|
7
|
+
module Base
|
8
|
+
class RemoveZero
|
9
|
+
attr_accessor :strategy, :options
|
10
|
+
|
11
|
+
def initialize(proxy, *_args)
|
12
|
+
@strategy = proxy.strategy
|
13
|
+
@options = proxy.options
|
14
|
+
end
|
15
|
+
|
16
|
+
def result
|
17
|
+
active?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def active?
|
23
|
+
@options[:remove_zero]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,25 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module FiguresConverter
|
4
6
|
module Options
|
5
7
|
module Cs
|
6
|
-
class Gender
|
7
|
-
attr_accessor :strategy, :options
|
8
|
-
|
9
|
-
def initialize(proxy, *_args)
|
10
|
-
@strategy = proxy.strategy
|
11
|
-
@options = proxy.options
|
12
|
-
end
|
13
|
-
|
8
|
+
class Gender < Base::Gender
|
14
9
|
def result
|
15
10
|
active? ? @options[:gender].to_sym : :female
|
16
11
|
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def active?
|
21
|
-
@options[:gender]
|
22
|
-
end
|
23
12
|
end
|
24
13
|
end
|
25
14
|
end
|
@@ -1,23 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module FiguresConverter
|
4
6
|
module Options
|
5
7
|
module Cs
|
6
|
-
class Ordinal
|
7
|
-
def initialize(proxy, *_args)
|
8
|
-
@strategy = proxy.strategy
|
9
|
-
@options = proxy.options
|
10
|
-
end
|
11
|
-
|
12
|
-
def result
|
13
|
-
return :ordinal if active?
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def active?
|
19
|
-
@options[:ordinal]
|
20
|
-
end
|
8
|
+
class Ordinal < Base::Ordinal
|
21
9
|
end
|
22
10
|
end
|
23
11
|
end
|
@@ -1,25 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumbersAndWords
|
2
4
|
module Strategies
|
3
5
|
module FiguresConverter
|
4
6
|
module Options
|
5
7
|
module Cs
|
6
|
-
class RemoveZero
|
7
|
-
attr_accessor :strategy, :options
|
8
|
-
|
9
|
-
def initialize(proxy, *_args)
|
10
|
-
@strategy = proxy.strategy
|
11
|
-
@options = proxy.options
|
12
|
-
end
|
13
|
-
|
14
|
-
def result
|
15
|
-
active?
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def active?
|
21
|
-
@options[:remove_zero]
|
22
|
-
end
|
8
|
+
class RemoveZero < Base::RemoveZero
|
23
9
|
end
|
24
10
|
end
|
25
11
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union'
|
2
4
|
require 'numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen'
|
3
5
|
require 'numbers_and_words/strategies/figures_converter/options/en-GB/ordinal'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union'
|
2
4
|
require 'numbers_and_words/strategies/figures_converter/options/en/remove_hyphen'
|
3
5
|
require 'numbers_and_words/strategies/figures_converter/options/en/ordinal'
|