Class: NumbersAndWords::Strategies::FiguresConverter::Languages::Es
- Inherits:
-
Base
- Object
- Base
- NumbersAndWords::Strategies::FiguresConverter::Languages::Es
show all
- Includes:
- Families::Latin
- Defined in:
- lib/numbers_and_words/strategies/figures_converter/languages/es.rb
Instance Attribute Summary
#current_capacity, #parent_figures
Attributes inherited from Base
#decorator, #figures, #language, #options, #translations
Instance Method Summary
collapse
#complex_number_to_words, #complex_tens, #hundreds_number_to_words, #save_parent_figures, #simple_number_to_words, #strings_logic, #words_in_capacity
#translate
Methods inherited from Base
#initialize, #run
Instance Method Details
#capacity_iteration ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 8
def capacity_iteration
words = []
capacity_words = words_in_capacity(@current_capacity)
words.push megs(capacity_words) unless capacity_words.empty?
if 0 < @current_capacity
capacity_words = capacity_words.map { |word|
word.gsub(@translations.ones(1), @translations.one) unless is_a_thousand? and is_a_one?
}.compact
end
words + capacity_words
end
|
#hundreds ⇒ Object
35
36
37
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 35
def hundreds
super({:is_hundred => (figures[1,2] == [0,1] && simple_number_to_words.empty?)})
end
|
#is_a_one? ⇒ Boolean
27
28
29
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 27
def is_a_one?
[translations.ones(1)] == words_in_capacity(@current_capacity)
end
|
#is_a_thousand? ⇒ Boolean
31
32
33
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 31
def is_a_thousand?
@current_capacity.odd?
end
|
#megs(capacity_words) ⇒ Object
39
40
41
|
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 39
def megs capacity_words
super({:is_one => capacity_words == [@translations.ones(1)]})
end
|