Class: Respanol::Pronombre

Inherits:
Object
  • Object
show all
Defined in:
lib/respanol/pronombre.rb

Constant Summary collapse

YO =
'Yo'
TU =
'Tu'
EL =
'El'
ELLA =
'Ella'
USTED =
'Usted'
NOSOTROS =
'Nosotros'
NOSOTRAS =
'Nosotras'
VOSOTROS =
'Vosotros'
VOSOTRAS =
'Vosotras'
ELLOS =
'Ellos'
ELLAS =
'Ellas'
USTEDES =
'Ustedes'

Class Method Summary collapse

Class Method Details

.plural?(pro) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/respanol/pronombre.rb', line 24

def self.plural?(pro)
  plurals.include?(pro)
end

.plural_primera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/respanol/pronombre.rb', line 60

def self.plural_primera?(pro)
  [NOSOTROS, NOSOTRAS].include?(pro)
end

.plural_segunda?(pro) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/respanol/pronombre.rb', line 64

def self.plural_segunda?(pro)
  [VOSOTROS, VOSOTRAS].include?(pro)
end

.plural_tercera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/respanol/pronombre.rb', line 68

def self.plural_tercera?(pro)
  [ELLOS, ELLAS, USTEDES].include?(pro)
end

.pluralsObject



20
21
22
# File 'lib/respanol/pronombre.rb', line 20

def self.plurals
  @plurals ||= [NOSOTROS, NOSOTRAS, VOSOTROS, VOSOTRAS, ELLOS, ELLAS, USTEDES]
end

.primera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/respanol/pronombre.rb', line 36

def self.primera?(pro)
  [YO, NOSOTROS, NOSOTRAS].include?(pro)
end

.segunda?(pro) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/respanol/pronombre.rb', line 40

def self.segunda?(pro)
  [TU, VOSOTROS, VOSOTRAS].include?(pro)
end

.singular?(pro) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/respanol/pronombre.rb', line 32

def self.singular?(pro)
  singulars.include?(pro)
end

.singular_primera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/respanol/pronombre.rb', line 48

def self.singular_primera?(pro)
  pro == YO
end

.singular_segunda?(pro) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/respanol/pronombre.rb', line 52

def self.singular_segunda?(pro)
  pro == TU
end

.singular_tercera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/respanol/pronombre.rb', line 56

def self.singular_tercera?(pro)
  [EL, ELLA, USTED].include?(pro)
end

.singularsObject



28
29
30
# File 'lib/respanol/pronombre.rb', line 28

def self.singulars
  @singulars ||= [YO, TU, EL, ELLA, USTED]
end

.tercera?(pro) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/respanol/pronombre.rb', line 44

def self.tercera?(pro)
  [El, ELLA, USTED, ELLOS, ELLAS, USTEDES].include?(pro)
end

.todosObject



16
17
18
# File 'lib/respanol/pronombre.rb', line 16

def self.todos
  @all ||= [YO, TU, EL, ELLA, USTED, NOSOTROS, NOSOTRAS, VOSOTROS, VOSOTRAS, ELLOS, ELLAS, USTEDES]
end

.verbo_indice(pro) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/respanol/pronombre.rb', line 72

def self.verbo_indice(pro)
  metodos = [
    :singular_primera?, :singular_segunda?, :singular_tercera?,
    :plural_primera?, :plural_segunda?, :plural_tercera?
  ]

  metodos.find_index { |m| self.send(m, pro) }
end