Class: NumbersAndWords::Strategies::FiguresConverter::Languages::Hu
- Inherits:
-
Base
- Object
- Base
- NumbersAndWords::Strategies::FiguresConverter::Languages::Hu
show all
- Defined in:
- lib/numbers_and_words/strategies/figures_converter/languages/hu.rb
Instance Attribute Summary
Attributes inherited from Base
#decorator, #figures, #language, #options, #translations
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #run
Instance Method Details
#complex_number_to_words ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 30
def complex_number_to_words
count = @figures.capacity_count
(1..count).map do |capacity|
@current_capacity = capacity
capacity_iteration.flatten
end.reject(&:empty?)
end
|
#greater_than_2000? ⇒ Boolean
14
15
16
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 14
def greater_than_2000?
@figures.length > 4 || (@figures.length == 4 && @figures.last >= 2)
end
|
#inner_reverse_words ⇒ Object
10
11
12
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 10
def inner_reverse_words
@strings.collect { |iteration| iteration.reverse.join }
end
|
#maybe_ordinal(type) ⇒ Object
54
55
56
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 54
def maybe_ordinal(type)
@options.ordinal.result type
end
|
#print_words ⇒ Object
6
7
8
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 6
def print_words
inner_reverse_words.reverse.join(greater_than_2000? && '-' || '')
end
|
#simple_number_to_words ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 38
def simple_number_to_words
if @figures.teens || @figures.tens
[complex_tens]
elsif @figures.ones
[ones]
else
[]
end
end
|
#strings_logic ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/hu.rb', line 18
def strings_logic
if @figures.capacity_count
number_without_capacity_to_words + complex_number_to_words
elsif @figures.hundreds
[hundreds_number_to_words]
elsif @figures.tens || @figures.ones
[simple_number_to_words]
else
[]
end
end
|