Class: NumbersAndWords::Strategies::FiguresConverter::Languages::Es
- Includes:
- Families::Latin
- Defined in:
- lib/numbers_and_words/strategies/figures_converter/languages/es.rb
Instance Attribute Summary
Attributes included from Families::Base
#current_capacity, #parent_figures
Attributes inherited from Base
#decorator, #figures, #language, #options, #translations
Instance Method Summary collapse
Methods included from Families::Base
#complex_number_to_words, #complex_tens, #hundreds_number_to_words, #save_parent_figures, #simple_number_to_words, #strings_logic, #words_in_capacity
Methods included from Families::Helpers
Methods inherited from Base
Constructor Details
This class inherits a constructor from NumbersAndWords::Strategies::FiguresConverter::Base
Instance Method Details
#capacity_iteration ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 # eg 1000000 should be "un millon" not "uno millon" # 501000 should be "quinientos un mil" not "quinientos uno mil" # so we replace "uno" with "un" throughout capacity_words = capacity_words.map{|word| word.gsub( @translations.ones(1), @translations.one ) } end words + capacity_words end |
#hundreds ⇒ Object
26 27 28 |
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 26 def hundreds super({:is_hundred => (figures[1,2] == [0,1] && simple_number_to_words.empty?)}) end |
#megs(capacity_words) ⇒ Object
30 31 32 |
# File 'lib/numbers_and_words/strategies/figures_converter/languages/es.rb', line 30 def megs capacity_words super({:is_one => capacity_words == [@translations.ones(1)]}) end |