numbers_and_words 0.11.12 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/README.rdoc +26 -6
  4. data/lib/numbers_and_words/helper_classes/figures_array.rb +2 -2
  5. data/lib/numbers_and_words/helper_classes/words_array.rb +2 -2
  6. data/lib/numbers_and_words/i18n/locales/numbers.da.yml +52 -0
  7. data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +1 -1
  8. data/lib/numbers_and_words/strategies/figures_converter/languages/da.rb +56 -0
  9. data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +1 -1
  10. data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +3 -3
  11. data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +1 -1
  12. data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +1 -1
  13. data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +1 -1
  14. data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +4 -4
  15. data/lib/numbers_and_words/strategies/figures_converter/languages.rb +1 -0
  16. data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +1 -1
  17. data/lib/numbers_and_words/strategies/figures_converter/options/da/gender.rb +14 -0
  18. data/lib/numbers_and_words/strategies/figures_converter/options/da.rb +3 -0
  19. data/lib/numbers_and_words/strategies/figures_converter/options.rb +1 -0
  20. data/lib/numbers_and_words/strategies/figures_converter.rb +2 -2
  21. data/lib/numbers_and_words/translations/da.rb +37 -0
  22. data/lib/numbers_and_words/translations/es.rb +1 -1
  23. data/lib/numbers_and_words/translations/et.rb +1 -1
  24. data/lib/numbers_and_words/translations/fr.rb +3 -3
  25. data/lib/numbers_and_words/translations/hu.rb +1 -1
  26. data/lib/numbers_and_words/translations/it.rb +1 -1
  27. data/lib/numbers_and_words/translations/nl.rb +1 -1
  28. data/lib/numbers_and_words/translations/pt-BR.rb +3 -3
  29. data/lib/numbers_and_words/translations/pt.rb +1 -1
  30. data/lib/numbers_and_words/translations/se.rb +1 -1
  31. data/lib/numbers_and_words/translations.rb +1 -0
  32. data/lib/numbers_and_words/version.rb +1 -1
  33. data/lib/numbers_and_words/wrappers/float.rb +1 -1
  34. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0cae184fece1fb7a27a25a61b57d0055ab90119374f7837755df26c8683eaf8
4
- data.tar.gz: 913165cd689041cf5ffc006549951bdac7886e9119eab763a920080138e51e7a
3
+ metadata.gz: f7503257030adb52e2ff1704101a18dce89c3f20adbf07f259f7483452098d3b
4
+ data.tar.gz: ac2e88eb5d1d0fc1cd3aa2f7107dea6b83a8c96818280ff4e410f0e77055e656
5
5
  SHA512:
6
- metadata.gz: 3d85520a2eb111cf5b872974d226fccea4403451f429e85b19c803e62339925c9a75a5e13a87b88243318a26818854cbbce4e974c02ad603be8e2369c26a7941
7
- data.tar.gz: 40bb39e40013a3209f9c64b69938e4b56cdfb5a94a2cc270b5e7b143b320efa724111e5a9ebd59e73989cd509115b87b42ee705b8b4b439e35a061fdcf5df803
6
+ metadata.gz: b8f82e6d2cadd49ca7af046963f4db230d86511a0d09bf0b9404a8f1373df2a4076e418ec5645f14626082cc79ce64574d5c4a1beada1ac6412c24a633f873a5
7
+ data.tar.gz: 1920bfb10e576382d1cdfc439ad870baf3d1e6db53193b29a63a05403c32340fb0e32dd9a7cf579b14f5a8702ec6b5874e36f02f9b69eb9e46174ff8d570fea3
data/CHANGELOG.md CHANGED
@@ -1,8 +1,17 @@
1
- ## 0.11.13 (Next)
1
+ ## 1.1.0 (Next)
2
2
 
3
3
  ### Features
4
4
  * Your contribution here.
5
5
 
6
+ ## 1.0.0 (October 17, 2024)
7
+
8
+ ### Features
9
+ * Add support for Danish language. \[[#197](https://github.com/kslazarev/numbers_and_words/pull/197)\] \([@franta](https://github.com/Franta1205)\)
10
+ * Upgrade RuboCop to 1.63.5. \[[#198](https://github.com/kslazarev/numbers_and_words/pull/198)\]
11
+ * Drop support for Ruby 2.7. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
12
+ * Drop support for Ruby 3.0. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
13
+ * Add support for Ruby 3.3. \[[#202](https://github.com/kslazarev/numbers_and_words/pull/202)\]
14
+
6
15
  ## 0.11.12 (April 22, 2023)
7
16
 
8
17
  ### Features
data/README.rdoc CHANGED
@@ -1,9 +1,9 @@
1
1
  == numbers_and_words
2
2
 
3
- {<img src="https://badge.fury.io/rb/numbers_and_words.svg?branch=master" alt="Gem Version" />}[http://badge.fury.io/rb/numbers_and_words]
4
- {<img src="https://codeclimate.com/github/kslazarev/numbers_and_words.svg?branch=master" />}[https://codeclimate.com/github/kslazarev/numbers_and_words]
5
- {<img src="https://secure.travis-ci.org/kslazarev/numbers_and_words.svg?branch=master" />}[http://travis-ci.org/kslazarev/numbers_and_words]
6
- {<img src="https://coveralls.io/repos/kslazarev/numbers_and_words/badge.svg?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/kslazarev/numbers_and_words]
3
+ {rdoc-image:https://badge.fury.io/rb/numbers_and_words.svg?branch=master}[https://badge.fury.io/rb/numbers_and_words]
4
+ {rdoc-image:https://codeclimate.com/github/kslazarev/numbers_and_words.svg?branch=master}[https://codeclimate.com/github/kslazarev/numbers_and_words]
5
+ {rdoc-image:https://github.com/kslazarev/numbers_and_words/actions/workflows/ci.yml/badge.svg?branch=master}[https://github.com/kslazarev/numbers_and_words/actions/workflows/ci.yml]
6
+ {rdoc-image:https://coveralls.io/repos/kslazarev/numbers_and_words/badge.svg?branch=master}[https://coveralls.io/r/kslazarev/numbers_and_words]
7
7
 
8
8
  Spell out numbers in several languages using the I18n gem.
9
9
 
@@ -42,6 +42,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
42
42
  * Português Brasileiro [pt-BR]
43
43
  * հայերեն (Armenian) [hy]
44
44
  * Қазақша [kz]
45
+ * Dansk [da]
45
46
 
46
47
  ** Experimental
47
48
 
@@ -93,6 +94,9 @@ Deletrea números en varios idiomas utilizando la gema I18n.
93
94
  I18n.with_locale(:kz) { 42.to_words }
94
95
  => "қырық екi"
95
96
 
97
+ I18n.with_locale(:da) { 42.to_words }
98
+ => "toogfyrre"
99
+
96
100
  21.to_words
97
101
  => "twenty-one"
98
102
  => "veintiuno"
@@ -114,6 +118,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
114
118
  => "hai mươi mốt"
115
119
  => "քսան մեկ"
116
120
  => "жиырма бiр"
121
+ => "enogtyve"
117
122
 
118
123
  231.to_words
119
124
  => "two hundred thirty-one"
@@ -136,6 +141,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
136
141
  => "hai trăm ba mươi mốt"
137
142
  => "երկու հարյուր երեսուն մեկ"
138
143
  => "екi жүз отыз бiр"
144
+ => "to hundrede enogtredive"
139
145
 
140
146
  4030.to_words
141
147
  => "four thousand thirty"
@@ -157,6 +163,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
157
163
  => "bốn nghìn không trăm ba mươi"
158
164
  => "չորս հազար երեսուն"
159
165
  => "төрт мың отыз"
166
+ => "fire tusinde tredive"
160
167
 
161
168
  1000100.to_words
162
169
  => "one million one hundred"
@@ -178,6 +185,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
178
185
  => "một triệu một trăm"
179
186
  => "մեկ միլիոն հարյուր"
180
187
  => "бiр миллион бiр жүз"
188
+ => "en million et hundrede"
181
189
 
182
190
  1000000000000000000000000000000000.to_words
183
191
  => "one decillion"
@@ -211,6 +219,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
211
219
  => ["một", "hai", "ba"]
212
220
  => ["մեկ", "երկու", "երեք"]
213
221
  => ["бiр", "екi", "үш"]
222
+ => ["et", "to", "tre"]
214
223
 
215
224
  [11, 22, 133].to_words
216
225
  => ["eleven", "twenty-two", "one hundred thirty-three"]
@@ -232,6 +241,7 @@ Deletrea números en varios idiomas utilizando la gema I18n.
232
241
  => ["mười một", "hai mươi hai", "một trăm ba mươi ba"]
233
242
  => ["տասնմեկ", "քսան երկու", "հարյուր երեսուն երեք"]
234
243
  => ["он бiр", "жиырма екi", "бiр жүз отыз үш"]
244
+ => ["elleve", "toogtyve", "et hundrede treogtredive"]
235
245
 
236
246
  21.77.to_words
237
247
  => "twenty-one and seventy-seven hundredths"
@@ -353,6 +363,16 @@ Deletrea números en varios idiomas utilizando la gema I18n.
353
363
  I18n.with_locale(:es) { 0.7.to_words remove_zero: true }
354
364
  => "siete décimas"
355
365
 
366
+ * Danish
367
+
368
+ Change gender from: (gender: [:neuter || :common])
369
+
370
+ I18n.with_locale(:da) { 1.to_words gender: :common }
371
+ => "en"
372
+
373
+ I18n.with_locale(:da) { 1.to_words gender: :neuter }
374
+ => "et"
375
+
356
376
  == Other options / Другие опции
357
377
 
358
378
  * Precision
@@ -367,8 +387,8 @@ Deletrea números en varios idiomas utilizando la gema I18n.
367
387
 
368
388
  == Requirements / Требования / Configuration Requise
369
389
 
370
- * 2.7 <= Ruby (compatible with/совместимость с/compatible avec Ruby 2.7 and/и/et JRuby);
371
- * 0.5.0 <= I18n (earlier versions not tested/ранние версии не тестировались/versions précédentes non testées);
390
+ * 3.1 <= Ruby (compatible with/совместимость с/compatible avec Ruby 3.1 and/и/et JRuby);
391
+ * 1.14.3 <= I18n (earlier versions not tested/ранние версии не тестировались/versions précédentes non testées);
372
392
 
373
393
  == Installation / Установка / Installation
374
394
 
@@ -18,8 +18,8 @@ module NumbersAndWords
18
18
  super.to_figures
19
19
  end
20
20
 
21
- def local_language(&block)
22
- ::I18n.with_locale(I18n.local_language, &block)
21
+ def local_language(&)
22
+ ::I18n.with_locale(I18n.local_language, &)
23
23
  end
24
24
  end
25
25
  end
@@ -8,8 +8,8 @@ module NumbersAndWords
8
8
  local_language { Strategies.array_joiner.new(to_a, options).run }
9
9
  end
10
10
 
11
- def local_language(&block)
12
- ::I18n.with_locale(I18n.local_language, &block)
11
+ def local_language(&)
12
+ ::I18n.with_locale(I18n.local_language, &)
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,52 @@
1
+ da:
2
+ numbers:
3
+ ones: [nul, et, to, tre, fire, fem, seks, syv, otte, ni]
4
+ common: [nul, en, to, tre, fire, fem, seks, syv, otte, ni]
5
+ neuter: [nul, et, to, tre, fire, fem, seks, syv, otte, ni]
6
+ teens: [_, elleve, tolv, tretten, fjorten, femten, seksten, sytten, atten, nitten]
7
+ tens: [_, ti, tyve, tredive, fyrre, halvtreds, tres, halvfjerds, firs, halvfems]
8
+ hundreds: [ _, et hundrede, to hundrede, tre hundrede, fire hundrede, fem hundrede, seks hundrede, syv hundrede, otte hundrede, ni hundrede ]
9
+ one_hundred: et hundrede
10
+ mega: [_, tusinde, million, milliard, billion, billiard, trillion]
11
+ tusinde:
12
+ one: tusinde
13
+ other: tusinde
14
+ million:
15
+ one: million
16
+ other: millioner
17
+ milliard:
18
+ one: milliard
19
+ other: milliarder
20
+ billion:
21
+ one: billion
22
+ other: billioner
23
+ billiard:
24
+ one: billiard
25
+ other: billiarder
26
+ trillion:
27
+ one: trillion
28
+ other: trillioner
29
+ ordinal:
30
+ ones: [nulte, første, anden, tredje, fjerde, femte, sjette, syvende, ottende, niende]
31
+ teens: [tiende, ellevte, tolvte, trettende, fjortende, femtende, sekstende, syttende, attende, nittende]
32
+ tens: [_, tiende, tyvende, tredive, fyrre, halvtreds, tres, halvfjerds, firs, halvfems]
33
+ hundreds: hundredende
34
+ micro: [_, tiendedele, hundrededele, tusindedele, milliontedele]
35
+ tenths:
36
+ one: tiendedel
37
+ other: tiendedele
38
+ hundredths:
39
+ one: hundrededel
40
+ other: hundrededele
41
+ thousandths:
42
+ one: tusindedel
43
+ other: tusindedele
44
+ millionths:
45
+ one: milliontedel
46
+ other: milliontedele
47
+ micro_separator: og
48
+ micro_prefix:
49
+ tens: ti
50
+ hundreds: hundrede
51
+ union: '-'
52
+ union: og
@@ -36,7 +36,7 @@ module NumbersAndWords
36
36
  private
37
37
 
38
38
  def internal_options
39
- { gender: gender, prefix: maybe_ordinal }
39
+ { gender:, prefix: maybe_ordinal }
40
40
  end
41
41
 
42
42
  def maybe_remove_zero
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NumbersAndWords
4
+ module Strategies
5
+ module FiguresConverter
6
+ module Languages
7
+ class Da < Base
8
+ def print_words
9
+ complex_part.count > 1 ? print_megs_words : @strings.flatten.reverse.join(' ')
10
+ end
11
+
12
+ def ones
13
+ super({ gender: })
14
+ end
15
+
16
+ def hundreds
17
+ super({ is_hundred: hundred?, is_one_hundred: one_hundred? })
18
+ end
19
+
20
+ def megs
21
+ super({ number: @figures.number_in_capacity(@current_capacity) })
22
+ end
23
+
24
+ private
25
+
26
+ def simple_part
27
+ @strings.reject { |f| f.is_a?(Array) }
28
+ end
29
+
30
+ def complex_part
31
+ @strings - simple_part
32
+ end
33
+
34
+ def hundred?
35
+ figures[0].zero? && figures[1].zero? && simple_number_to_words.empty?
36
+ end
37
+
38
+ def one_hundred?
39
+ hundred? && figures[2] == 1
40
+ end
41
+
42
+ def gender
43
+ @current_capacity ||= 0
44
+ if @current_capacity.zero?
45
+ @options.gender.result
46
+ elsif @current_capacity == 1
47
+ :neuter
48
+ else
49
+ :common
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -21,7 +21,7 @@ module NumbersAndWords
21
21
  end
22
22
 
23
23
  def ones
24
- super(postfix: postfix)
24
+ super(postfix:)
25
25
  end
26
26
 
27
27
  def postfix
@@ -14,20 +14,20 @@ module NumbersAndWords
14
14
  end
15
15
 
16
16
  def ones
17
- super({ gender: gender,
17
+ super({ gender:,
18
18
  is_one_thousand: one_thousand?,
19
19
  is_apocopated: one_apocopated? })
20
20
  end
21
21
 
22
22
  def tens_with_ones
23
- options = { gender: gender, is_apocopated: one_apocopated? }
23
+ options = { gender:, is_apocopated: one_apocopated? }
24
24
  return @translations.twenties_with_ones(@figures, options) if @figures.tens == 2
25
25
 
26
26
  super(options)
27
27
  end
28
28
 
29
29
  def hundreds
30
- super({ gender: gender,
30
+ super({ gender:,
31
31
  is_apocopated: hundred_apocopated? })
32
32
  end
33
33
 
@@ -23,7 +23,7 @@ module NumbersAndWords
23
23
 
24
24
  %i[ones tens_with_ones].each do |method_name|
25
25
  define_method(method_name) do |*args|
26
- super({ gender: gender }.merge(args.first || {}))
26
+ super({ gender: }.merge(args.first || {}))
27
27
  end
28
28
  end
29
29
 
@@ -20,7 +20,7 @@ module NumbersAndWords
20
20
  def megs
21
21
  prefix = (:partials if @figures.hundreds || @figures.tens || @figures.ones)
22
22
 
23
- super(prefix: prefix)
23
+ super(prefix:)
24
24
  end
25
25
 
26
26
  private
@@ -6,7 +6,7 @@ module NumbersAndWords
6
6
  module Languages
7
7
  class Lv < Base
8
8
  def tens_with_ones
9
- super separator: ' '
9
+ super(separator: ' ')
10
10
  end
11
11
 
12
12
  def megs
@@ -31,11 +31,11 @@ module NumbersAndWords
31
31
  end
32
32
 
33
33
  def ones
34
- super internal_options.merge(is_one_thousand: one_thousand?)
34
+ super(internal_options.merge(is_one_thousand: one_thousand?))
35
35
  end
36
36
 
37
37
  def hundreds
38
- super(internal_options.merge(is_hundred: hundred?, is_one_hundred: one_hundred?, gender: gender))
38
+ super(internal_options.merge(is_hundred: hundred?, is_one_hundred: one_hundred?, gender:))
39
39
  end
40
40
 
41
41
  def megs
@@ -48,7 +48,7 @@ module NumbersAndWords
48
48
  private
49
49
 
50
50
  def internal_options
51
- { gender: gender, prefix: maybe_ordinal }
51
+ { gender:, prefix: maybe_ordinal }
52
52
  end
53
53
 
54
54
  def maybe_ordinal
@@ -56,7 +56,7 @@ module NumbersAndWords
56
56
  end
57
57
 
58
58
  def gender
59
- return (options.gender.result || :male) if maybe_ordinal
59
+ return options.gender.result || :male if maybe_ordinal
60
60
 
61
61
  if current_capacity&.positive? && figures[0] == 1
62
62
  :male
@@ -23,6 +23,7 @@ require 'numbers_and_words/strategies/figures_converter/languages/se'
23
23
  require 'numbers_and_words/strategies/figures_converter/languages/tr'
24
24
  require 'numbers_and_words/strategies/figures_converter/languages/hy'
25
25
  require 'numbers_and_words/strategies/figures_converter/languages/kz'
26
+ require 'numbers_and_words/strategies/figures_converter/languages/da'
26
27
 
27
28
  require 'numbers_and_words/strategies/figures_converter/languages/families/cyrillic'
28
29
  require 'numbers_and_words/strategies/figures_converter/languages/ru'
@@ -12,7 +12,7 @@ module NumbersAndWords
12
12
  end
13
13
 
14
14
  def result
15
- return :ordinal if active?
15
+ :ordinal if active?
16
16
  end
17
17
 
18
18
  private
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NumbersAndWords
4
+ module Strategies
5
+ module FiguresConverter
6
+ module Options
7
+ module Da
8
+ class Gender < Base::Gender
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'numbers_and_words/strategies/figures_converter/options/da/gender'
@@ -10,6 +10,7 @@ require 'numbers_and_words/strategies/figures_converter/options/pt-BR'
10
10
  require 'numbers_and_words/strategies/figures_converter/options/ru'
11
11
  require 'numbers_and_words/strategies/figures_converter/options/ua'
12
12
  require 'numbers_and_words/strategies/figures_converter/options/cs'
13
+ require 'numbers_and_words/strategies/figures_converter/options/da'
13
14
 
14
15
  module NumbersAndWords
15
16
  module Strategies
@@ -25,8 +25,8 @@ module NumbersAndWords
25
25
 
26
26
  private
27
27
 
28
- def around(&block)
29
- decorator.run(&block)
28
+ def around(&)
29
+ decorator.run(&)
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NumbersAndWords
4
+ module Translations
5
+ class Da < Base
6
+ include NumbersAndWords::Translations::Families::Base
7
+
8
+ DEFAULT_POSTFIX = nil
9
+
10
+ def ones(number, options = {})
11
+ return t(:common)[number] if options[:gender] == :common
12
+ return t(:neuter)[number] if options[:gender] == :neuter
13
+
14
+ t([options[:prefix], :ones, options[:postfix] || DEFAULT_POSTFIX].join('.'))[number]
15
+ end
16
+
17
+ def tens(number, _options = {})
18
+ t(:tens)[number]
19
+ end
20
+
21
+ def tens_with_ones(numbers, _options = {})
22
+ [ones(numbers[0], { gender: :common }), tens(numbers[1])].join(union)
23
+ end
24
+
25
+ def hundreds(number, options = {})
26
+ return t(:one_hundred) if options[:is_one_hundred]
27
+ return t(:hundreds)[number] if options[:is_hundred]
28
+
29
+ t(:hundreds)[number]
30
+ end
31
+
32
+ def zero(_options = {})
33
+ ones 0
34
+ end
35
+ end
36
+ end
37
+ end
@@ -19,7 +19,7 @@ module NumbersAndWords
19
19
  end
20
20
 
21
21
  def tens_with_ones(numbers, options = {})
22
- super numbers, options.merge(separator: " #{union} ")
22
+ super(numbers, options.merge(separator: " #{union} "))
23
23
  end
24
24
 
25
25
  def twenties_with_ones(numbers, options = {})
@@ -6,7 +6,7 @@ module NumbersAndWords
6
6
  include NumbersAndWords::Translations::Families::Latin
7
7
 
8
8
  def hundreds(number, _options = {})
9
- super number, separator: ''
9
+ super(number, separator: '')
10
10
  end
11
11
  end
12
12
  end
@@ -11,19 +11,19 @@ module NumbersAndWords
11
11
  def tens(number, options = {})
12
12
  return t(:eighty) if number == SPECIAL_TENS_CASE && options[:alone].nil?
13
13
 
14
- super number, options
14
+ super
15
15
  end
16
16
 
17
17
  def tens_with_ones(numbers, options = {})
18
18
  return [tens(numbers[1] - 1, alone: false), teens(numbers)].join('-') if [7, 9].include? numbers[1]
19
19
 
20
20
  separator = numbers[0] == 1 ? " #{union} " : '-'
21
- super numbers, options.merge(separator: separator)
21
+ super(numbers, options.merge(separator:))
22
22
  end
23
23
 
24
24
  def hundreds(number, options = {})
25
25
  count = options[:pluralize] ? number : 1
26
- hundreds = t(:hundreds, count: count)
26
+ hundreds = t(:hundreds, count:)
27
27
 
28
28
  return hundreds if number == 1
29
29
 
@@ -12,7 +12,7 @@ module NumbersAndWords
12
12
  end
13
13
 
14
14
  def hundreds(number, options = {})
15
- super number, options.merge(separator: '')
15
+ super(number, options.merge(separator: ''))
16
16
  end
17
17
  end
18
18
  end
@@ -6,7 +6,7 @@ module NumbersAndWords
6
6
  include NumbersAndWords::Translations::Families::Latin
7
7
 
8
8
  def tens_with_ones(numbers, _options = {})
9
- super numbers, separator: ''
9
+ super(numbers, separator: '')
10
10
  end
11
11
 
12
12
  def hundreds(number, _options = {})
@@ -12,7 +12,7 @@ module NumbersAndWords
12
12
  def hundreds(number, _options = {})
13
13
  return t(:hundreds) if number == 1
14
14
 
15
- super number, separator: ''
15
+ super(number, separator: '')
16
16
  end
17
17
 
18
18
  private
@@ -29,7 +29,7 @@ module NumbersAndWords
29
29
  def teens(number, options = {})
30
30
  return [tens(1, options), ones(number[0], options)].join(' ') if ordinal? options
31
31
 
32
- super(number, options)
32
+ super
33
33
  end
34
34
 
35
35
  def tens_with_ones(numbers, options = {})
@@ -48,10 +48,10 @@ module NumbersAndWords
48
48
 
49
49
  def megs(capacity, options = {})
50
50
  return t([options[:prefix], :mega, options[:gender]].join('.'))[capacity] if ordinal?(options)
51
- return super(capacity, options) if options[:is_opaque] || options[:is_without_connector]
51
+ return super if options[:is_opaque] || options[:is_without_connector]
52
52
 
53
53
  suffix = options[:is_with_comma] ? ',' : " #{union}"
54
- super(capacity, options) + suffix
54
+ super + suffix
55
55
  end
56
56
 
57
57
  def micros(capacity, number = nil)
@@ -6,7 +6,7 @@ module NumbersAndWords
6
6
  include NumbersAndWords::Translations::Families::Latin
7
7
 
8
8
  def tens_with_ones(numbers, _options = {})
9
- super numbers, separator: " #{union} "
9
+ super(numbers, separator: " #{union} ")
10
10
  end
11
11
 
12
12
  def hundreds(number, options = {})
@@ -6,7 +6,7 @@ module NumbersAndWords
6
6
  include NumbersAndWords::Translations::Families::Latin
7
7
 
8
8
  def tens_with_ones(numbers, _options = {})
9
- super numbers, separator: '-'
9
+ super(numbers, separator: '-')
10
10
  end
11
11
  end
12
12
  end
@@ -27,6 +27,7 @@ require 'numbers_and_words/translations/cs'
27
27
  require 'numbers_and_words/translations/vi'
28
28
  require 'numbers_and_words/translations/hy'
29
29
  require 'numbers_and_words/translations/kz'
30
+ require 'numbers_and_words/translations/da'
30
31
 
31
32
  module NumbersAndWords
32
33
  module Translations
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NumbersAndWords
4
- VERSION = '0.11.12'
4
+ VERSION = '1.0.0'
5
5
  end
@@ -51,7 +51,7 @@ module NumbersAndWords
51
51
 
52
52
  def fractional_options
53
53
  length = precision || fractional_part.length
54
- { fractional: { length: length } }
54
+ { fractional: { length: } }
55
55
  end
56
56
 
57
57
  def fractional_part_is_nil?
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.12
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Lazarev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-23 00:00:00.000000000 Z
11
+ date: 2024-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -76,6 +76,7 @@ files:
76
76
  - lib/numbers_and_words/i18n.rb
77
77
  - lib/numbers_and_words/i18n/initialization.rb
78
78
  - lib/numbers_and_words/i18n/locales/numbers.cs.yml
79
+ - lib/numbers_and_words/i18n/locales/numbers.da.yml
79
80
  - lib/numbers_and_words/i18n/locales/numbers.de.yml
80
81
  - lib/numbers_and_words/i18n/locales/numbers.en-GB.yml
81
82
  - lib/numbers_and_words/i18n/locales/numbers.en.yml
@@ -165,6 +166,7 @@ files:
165
166
  - lib/numbers_and_words/strategies/figures_converter/languages.rb
166
167
  - lib/numbers_and_words/strategies/figures_converter/languages/base.rb
167
168
  - lib/numbers_and_words/strategies/figures_converter/languages/cs.rb
169
+ - lib/numbers_and_words/strategies/figures_converter/languages/da.rb
168
170
  - lib/numbers_and_words/strategies/figures_converter/languages/de.rb
169
171
  - lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb
170
172
  - lib/numbers_and_words/strategies/figures_converter/languages/en.rb
@@ -198,6 +200,8 @@ files:
198
200
  - lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb
199
201
  - lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb
200
202
  - lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb
203
+ - lib/numbers_and_words/strategies/figures_converter/options/da.rb
204
+ - lib/numbers_and_words/strategies/figures_converter/options/da/gender.rb
201
205
  - lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb
202
206
  - lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb
203
207
  - lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb
@@ -229,6 +233,7 @@ files:
229
233
  - lib/numbers_and_words/translations.rb
230
234
  - lib/numbers_and_words/translations/base.rb
231
235
  - lib/numbers_and_words/translations/cs.rb
236
+ - lib/numbers_and_words/translations/da.rb
232
237
  - lib/numbers_and_words/translations/de.rb
233
238
  - lib/numbers_and_words/translations/en-GB.rb
234
239
  - lib/numbers_and_words/translations/en.rb
@@ -270,14 +275,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
275
  requirements:
271
276
  - - ">="
272
277
  - !ruby/object:Gem::Version
273
- version: 2.7.0
278
+ version: 3.1.0
274
279
  required_rubygems_version: !ruby/object:Gem::Requirement
275
280
  requirements:
276
281
  - - ">="
277
282
  - !ruby/object:Gem::Version
278
283
  version: '0'
279
284
  requirements: []
280
- rubygems_version: 3.4.8
285
+ rubygems_version: 3.5.19
281
286
  signing_key:
282
287
  specification_version: 4
283
288
  summary: Spell out numbers in several languages