Class: NumbersAndWords::Strategies::FiguresConverter::Languages::PtBr

Inherits:
Base
  • Object
show all
Defined in:
lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb

Instance Attribute Summary

Attributes inherited from Base

#figures, #options, #strategy, #strings, #translations

Attributes included from Families::Base

#current_capacity, #parent_figures

Instance Method Summary collapse

Methods inherited from Base

#initialize, #print_words

Methods included from Families::Base

#complex_tens, #hundreds_number_to_words, #save_parent_figures, #simple_number_to_words, #strings_logic, #words_in_capacity

Methods included from Families::Helpers

#translate

Constructor Details

This class inherits a constructor from NumbersAndWords::Strategies::FiguresConverter::Languages::Base

Instance Method Details

#capacity_iterationObject


26
27
28
29
30
31
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 26

def capacity_iteration
  words = []
  capacity_words = words_in_capacity(current_capacity)
  words.push(megs) unless capacity_words.empty? || (capacity_words.empty? && figures[0] == 1)
  words + capacity_words
end

#complex_number_to_wordsObject


22
23
24
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 22

def complex_number_to_words
  super.reject(&:nil?)
end

#hundredsObject


37
38
39
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 37

def hundreds
  super(internal_options.merge(is_hundred: hundred?, is_one_hundred: one_hundred?, gender: gender))
end

#megsObject


41
42
43
44
45
46
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 41

def megs
  super(internal_options.merge(number: @figures.number_in_capacity(@current_capacity),
                               is_opaque: opaque?,
                               is_without_connector: without_connector?,
                               is_with_comma: with_comma?))
end

#onesObject


33
34
35
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 33

def ones
  super internal_options.merge(is_one_thousand: one_thousand?)
end

#wordsObject


18
19
20
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 18

def words
  super.strip
end

#zeroObject


14
15
16
# File 'lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb', line 14

def zero
  super unless maybe_remove_zero
end