Class: NumbersAndWords::Translations::Pt

Inherits:
Base
  • Object
show all
Includes:
Families::Latin
Defined in:
lib/numbers_and_words/translations/pt.rb

Constant Summary

Constants inherited from Base

Base::I18N_NAMESPACE

Instance Method Summary collapse

Methods included from Families::Latin

#ones, #zero

Methods included from Families::Base

#mega, #teens, #union, #union_separator

Methods inherited from Base

#t

Instance Method Details

#hundreds(number, options = {}) ⇒ Object



15
16
17
18
# File 'lib/numbers_and_words/translations/pt.rb', line 15

def hundreds number, options = {}
  return t(:one_hundred) if options[:is_one_hundred]
  options[:is_hundred] ? t(:hundreds)[number - 1] : t(:hundreds)[number - 1] + ' e'
end

#megs(capacity, options = {}) ⇒ Object



20
21
22
23
# File 'lib/numbers_and_words/translations/pt.rb', line 20

def megs capacity, options = {}
  options[:is_one] = false if options[:is_one].nil?
  options[:is_one] ? t(:mega)[capacity] : t(:megas)[capacity]
end

#tens(numbers, options = {}) ⇒ Object



6
7
8
9
# File 'lib/numbers_and_words/translations/pt.rb', line 6

def tens numbers, options = {}
  options[:alone] = true if options[:alone].nil?
  options[:alone] ? super(numbers) : "#{t(:union)} " + super(numbers)
end

#tens_with_ones(numbers, options = {}) ⇒ Object



11
12
13
# File 'lib/numbers_and_words/translations/pt.rb', line 11

def tens_with_ones numbers, options = {}
  [tens(numbers[1]), " #{t(:union)} ", ones(numbers[0])].join
end