Class: NumbersAndWords::Translations::Es

Inherits:
Base
  • Object
show all
Includes:
NumbersAndWords::Translations::Extensions::FractionSignificance, Families::Latin
Defined in:
lib/numbers_and_words/translations/es.rb

Constant Summary

Constants inherited from Base

Base::I18N_NAMESPACE

Instance Method Summary collapse

Methods included from NumbersAndWords::Translations::Extensions::FractionSignificance

#micro

Methods included from Families::Base

#mega, #megs, #teens, #tens, #union, #union_separator

Methods inherited from Base

#t

Instance Method Details

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



31
32
33
34
# File 'lib/numbers_and_words/translations/es.rb', line 31

def hundreds(number, options = {})
  return t(%i[hundreds apocopated].join('.')) if options[:is_apocopated]
  t([:hundreds, options[:gender]].join('.'))[number]
end

#micro_prefix(capacity) ⇒ Object



42
43
44
45
46
47
# File 'lib/numbers_and_words/translations/es.rb', line 42

def micro_prefix(capacity)
  case capacity
  when 2 then t('micro_prefix.hundreds')
  when 1 then t('micro_prefix.tens')
  end
end

#micros(capacity, number = nil) ⇒ Object



36
37
38
39
40
# File 'lib/numbers_and_words/translations/es.rb', line 36

def micros(capacity, number = nil)
  micro, prefix = capacity
  micros = number ? t(micro(micro), count: number) : micro(micro)
  [micro_prefix(prefix), micros].compact.join
end

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



11
12
13
14
15
# File 'lib/numbers_and_words/translations/es.rb', line 11

def ones(number, options = {})
  return if options[:is_one_thousand]
  return t(%i[ones apocopated].join('.')) if options[:is_apocopated]
  t([:ones, options[:gender]].join('.'))[number]
end

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



22
23
24
25
26
27
28
29
# File 'lib/numbers_and_words/translations/es.rb', line 22

def tens_with_ones(numbers, options = {})
  ones_number = if options[:is_apocopated] && numbers[0] == 1
                  t(%i[ones apocopated].join('.'))
                else
                  t([:ones, options[:gender]].join('.'))[numbers[0]]
                end
  [tens(numbers[1], alone: false), t(:union), ones_number].join(' ')
end

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



17
18
19
20
# File 'lib/numbers_and_words/translations/es.rb', line 17

def twenties_with_ones(numbers, options = {})
  return t(%i[twenties apocopated].join('.')) if options[:is_apocopated]
  t([:twenties, options[:gender]].join('.'))[numbers[0]]
end

#zero(_options = {}) ⇒ Object



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

def zero(_options = {})
  t(%i[ones male].join('.'))[0]
end