Class: Verbs::Conjugator::Conjugations

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/verbs/conjugator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConjugations

Returns a new instance of Conjugations.



10
11
12
# File 'lib/verbs/conjugator.rb', line 10

def initialize
  @irregulars, @single_terminal_consonants, @copulars = {}, [], {}
end

Instance Attribute Details

#copularsObject (readonly)

Returns the value of attribute copulars.



8
9
10
# File 'lib/verbs/conjugator.rb', line 8

def copulars
  @copulars
end

#irregularsObject (readonly)

Returns the value of attribute irregulars.



8
9
10
# File 'lib/verbs/conjugator.rb', line 8

def irregulars
  @irregulars
end

#single_terminal_consonantsObject (readonly)

Returns the value of attribute single_terminal_consonants.



8
9
10
# File 'lib/verbs/conjugator.rb', line 8

def single_terminal_consonants
  @single_terminal_consonants
end

Instance Method Details

#irregular(infinitive, preterite = nil, past_participle = nil, &blk) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/verbs/conjugator.rb', line 14

def irregular(infinitive, preterite = nil, past_participle = nil, &blk)
  if block_given?
    irregular = ::Verbs::Verb.new infinitive, &blk
  else
    raise ArgumentError, "Standard irregular verbs must specify preterite and past participle forms" unless preterite and past_participle
    irregular = ::Verbs::Verb.new infinitive, :preterite => preterite, :past_participle => past_participle
  end
  @irregulars[infinitive] = irregular
end

#single_terminal_consonant(infinitive) ⇒ Object



24
25
26
# File 'lib/verbs/conjugator.rb', line 24

def single_terminal_consonant(infinitive)
  @single_terminal_consonants << infinitive
end