Class: Hablaba

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

Overview

accented chars for copying into an editor: é ú á í ñ ó

Class Method Summary collapse

Class Method Details

.conjugate(pronoun, verb, tense = :present) ⇒ Object

Conjugate a Spanish verb

Example:

>> Hablaba.conjugate('yo', 'hablar')
=> hablo

Arguments:

pronoun: (String)
verb: (String)
tense: (Symbol)
  - optional, defaults to :present
  - options: :present, :preterite, :imperfect


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/hablaba.rb', line 19

def conjugate(pronoun, verb, tense = :present)
  pronoun, verb = pronoun.downcase, verb.downcase
  case tense
  when :present
    conjugate_in_the_present(pronoun, verb)
  when :preterite
    conjugate_in_the_preterite(pronoun, verb)
  when :imperfect
    conjugate_in_the_imperfect(pronoun, verb)
  when :present_subjunctive
    conjugate_in_the_present_subjunctive(pronoun, verb)
  when :imperfect_subjunctive
    conjugate_in_the_imperfect_subjunctive(pronoun, verb)
  when :conditional
    conjugate_in_the_conditional(pronoun, verb)
  when :future
    conjugate_in_the_future(pronoun, verb)
  else
    # TODO: raise error
  end
end