Class: NumbersAndWords::Translations::Es

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

Constant Summary collapse

TENS_CASE =
2

Constants inherited from Base

Base::I18N_NAMESPACE

Instance Method Summary collapse

Methods included from Families::Latin

#zero

Methods included from Families::Base

#mega, #teens, #union, #union_separator

Methods inherited from Base

#t

Instance Method Details

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



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

def hundreds number, options = {}
  options[:is_hundred] = false if options[:is_hundred].nil?
  options[:is_hundred] ? t(:one_hundred) : t(:hundreds)[number - 1]
end

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



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

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

#one(options = {}) ⇒ Object



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

def one options = {}
  t(:one)
end

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



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

def ones number, options = {}
  t(:ones)[number]
end

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



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

def tens numbers, options = {}
  options[:alone] = true if options[:alone].nil?
  (numbers == TENS_CASE && options[:alone]) ? t(:twenty) : super(numbers)
end

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



21
22
23
24
# File 'lib/numbers_and_words/translations/es.rb', line 21

def tens_with_ones numbers, options = {}
  inter = numbers[1] == TENS_CASE ? "" : " y "
  [tens(numbers[1], :alone => false), ones(numbers[0])].join inter
end