Class: NumbersAndWords::Strategies::FiguresConverter::Languages::De

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

Instance Attribute Summary

Attributes inherited from Base

#decorator, #figures, #language, #options, #translations

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run

Constructor Details

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

Instance Method Details

#complex_number_to_wordsObject



16
17
18
19
20
21
# File 'lib/numbers_and_words/strategies/figures_converter/languages/de.rb', line 16

def complex_number_to_words
  (1..@figures.capacity_count).map do |capacity|
    @current_capacity = capacity
    capacity_iteration
  end
end

#megsObject



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

def megs
  super({ number: @figures.number_in_capacity(@current_capacity) })
end

#onesObject



23
24
25
# File 'lib/numbers_and_words/strategies/figures_converter/languages/de.rb', line 23

def ones
  super(postfix: postfix)
end

#postfixObject



27
28
29
30
31
32
33
# File 'lib/numbers_and_words/strategies/figures_converter/languages/de.rb', line 27

def postfix
  case (@current_capacity ||= 0)
  when 1 then :combine
  when 0 then :default
  else :gender
  end
end


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

def print_megs_words
  [print_megs, print_other].reject(&:empty?).join(' ')
end


8
9
10
# File 'lib/numbers_and_words/strategies/figures_converter/languages/de.rb', line 8

def print_words
  complex_part.count > 1 ? print_megs_words : @strings.flatten.reverse.join
end