class NumbersAndWords::Strategies::FiguresConverter::Languages::Vi
Public Instance Methods
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 93 def billion_unit translate :mega, 3 end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 72 def fraction_length return 0 unless @options.options[:fractional] @options.options[:fractional][:length] end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 78 def fraction_number_zeros_leading fraction_length - @figures.length end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 68 def fractional? !@options.options[:fractional].nil? && !@options.options[:integral] end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 26 def fractional_with_zero_leading_string_logic leading_zeros = [0] * fraction_number_zeros_leading (@figures + leading_zeros).map(&:to_words) end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 48 def hundreds(options = {}) if @figures.hundreds.to_i.zero? translate :hundreds, 0, options else super end end
Calls superclass method
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 43 def hundreds? @figures.hundreds || (@figures.size == 3 && (@figures.teens || @figures.tens || @figures.ones)) end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 31 def integral_string_logic if @figures.capacity_count number_without_capacity_to_words + complex_number_to_words elsif hundreds? hundreds_number_to_words elsif @figures.tens || @figures.ones simple_number_to_words else [] end end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 56 def ones(options = {}) if @figures.capacity_length >= 2 ones_union(options) else super end end
Calls superclass method
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 64 def ones_union(options = {}) translate :ones_union, @figures.ones, options end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 8 def print_words value = super remove_billion_noise(value) end
Calls superclass method
NumbersAndWords::Strategies::FiguresConverter::Languages::Base#print_words
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 82 def remove_billion_noise(value) parts = value.split(billion_unit).map(&:strip) if value.end_with?(billion_unit) parts.insert(-1, billion_unit).join(' ') else return value if parts.size <= 2 parts.insert(-2, billion_unit).join(' ') end end
Source
# File lib/numbers_and_words/strategies/figures_converter/languages/vi.rb, line 13 def strings_logic if fractional? if fraction_number_zeros_leading.zero? @options.options[:integral] = true integral_string_logic else fractional_with_zero_leading_string_logic end else integral_string_logic end end