Class: NumbersAndWords::Strategies::FiguresConverter::Languages::En
- Inherits:
-
Base
- Object
- Base
- NumbersAndWords::Strategies::FiguresConverter::Languages::En
show all
- Includes:
- Families::Latin
- Defined in:
- lib/numbers_and_words/strategies/figures_converter/languages/en.rb
Direct Known Subclasses
EnGb
Instance Attribute Summary
#current_capacity, #parent_figures
Attributes inherited from Base
#decorator, #figures, #language, #options, #translations
Instance Method Summary
collapse
#capacity_iteration, #complex_number_to_words, #complex_tens, #hundreds_number_to_words, #save_parent_figures, #simple_number_to_words, #words_in_capacity
#megs, #translate
Methods inherited from Base
#initialize, #run
Instance Method Details
#hundreds ⇒ Object
14
15
16
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 14
def hundreds
maybe_union_after_hundreds super({ prefix: maybe_ordinal(:hundreds) })
end
|
#maybe_hyphen_separator ⇒ Object
43
44
45
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 43
def maybe_hyphen_separator
@options.remove_hyphen.result
end
|
#maybe_ordinal(type) ⇒ Object
47
48
49
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 47
def maybe_ordinal(type)
@options.ordinal.result type
end
|
#maybe_remove_zero ⇒ Object
55
56
57
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 55
def maybe_remove_zero
@options.remove_zero.result
end
|
#maybe_union_after_hundreds(translations) ⇒ Object
51
52
53
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 51
def maybe_union_after_hundreds(translations)
@options.hundreds_with_union.modify_or_leave translations
end
|
#strings_logic ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 29
def strings_logic
if @options.pronounced.active?
@options.pronounced.process self, @figures
elsif @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
|
#tens_with_ones ⇒ Object
22
23
24
25
26
27
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 22
def tens_with_ones
super({
separator: maybe_hyphen_separator,
prefix: maybe_ordinal(:tens_with_ones)
})
end
|
#zero ⇒ Object
18
19
20
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/en.rb', line 18
def zero
super({ prefix: maybe_ordinal(:zero) }) unless maybe_remove_zero
end
|