module NumbersAndWords::Strategies::FiguresConverter::Languages::Families::Base
Attributes
current_capacity[RW]
parent_figures[RW]
Public Instance Methods
capacity_iteration()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 32 def capacity_iteration words = [] capacity_words = words_in_capacity(@current_capacity) words.push(megs) unless capacity_words.empty? words + capacity_words end
complex_number_to_words()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 25 def complex_number_to_words (1..@figures.capacity_count).map do |capacity| @current_capacity = capacity capacity_iteration end.flatten end
complex_tens()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 52 def complex_tens @figures.ones ? tens_with_ones : tens end
hundreds_number_to_words()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 48 def hundreds_number_to_words simple_number_to_words + [hundreds] end
save_parent_figures() { || ... }
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 68 def save_parent_figures @parent_figures = @figures result = yield @figures = @parent_figures result end
simple_number_to_words()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 56 def simple_number_to_words if @figures.teens [teens] elsif @figures.tens [complex_tens] elsif @figures.ones [ones] else [] end end
strings_logic()
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 13 def strings_logic if @figures.capacity_count number_without_capacity_to_words + complex_number_to_words elsif @figures.hundreds hundreds_number_to_words elsif @figures.tens || @figures.ones simple_number_to_words else [] end end
words_in_capacity(capacity = 0)
click to toggle source
# File lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb, line 39 def words_in_capacity(capacity = 0) save_parent_figures do @figures = @parent_figures.figures_array_in_capacity(capacity) strings_logic end end
Also aliased as: number_without_capacity_to_words