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



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

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



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

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

#hundredsObject



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

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

#megsObject



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

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



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

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

#wordsObject



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

def words
  super.strip
end

#zeroObject



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

def zero
  super unless maybe_remove_zero
end