Class: Verbs::Conjugator::Conjugations
- Inherits:
-
Object
- Object
- Verbs::Conjugator::Conjugations
- Includes:
- Singleton
- Defined in:
- lib/verbs/conjugator.rb
Overview
This class determines the conjugations from the given options (or defaults) conjugations are then applied to the verb
Instance Attribute Summary collapse
-
#copulars ⇒ Object
readonly
permit outside functions access to these variables.
-
#irregulars ⇒ Object
readonly
permit outside functions access to these variables.
-
#single_terminal_consonants ⇒ Object
readonly
permit outside functions access to these variables.
Instance Method Summary collapse
-
#initialize ⇒ Conjugations
constructor
Creates initial variables for class.
-
#irregular(infinitive, preterite = nil, past_participle = nil, &blk) ⇒ Object
Determines irregular verbs from the expression Params: * infinitive, the given verb * preterite, denote events that took place in the past * past_participle, form of a verb, ending in ‘ed’ * &blk, block of code that may be run.
-
#single_terminal_consonant(infinitive) ⇒ Object
Find single terminal consonant with the infinitive Params: * infinitive, the given verb.
Constructor Details
#initialize ⇒ Conjugations
Creates initial variables for class
28 29 30 31 32 |
# File 'lib/verbs/conjugator.rb', line 28 def initialize @irregulars = {} @single_terminal_consonants = [] @copulars = {} end |
Instance Attribute Details
#copulars ⇒ Object (readonly)
permit outside functions access to these variables
25 26 27 |
# File 'lib/verbs/conjugator.rb', line 25 def copulars @copulars end |
#irregulars ⇒ Object (readonly)
permit outside functions access to these variables
25 26 27 |
# File 'lib/verbs/conjugator.rb', line 25 def irregulars @irregulars end |
#single_terminal_consonants ⇒ Object (readonly)
permit outside functions access to these variables
25 26 27 |
# File 'lib/verbs/conjugator.rb', line 25 def single_terminal_consonants @single_terminal_consonants end |
Instance Method Details
#irregular(infinitive, preterite = nil, past_participle = nil, &blk) ⇒ Object
Determines irregular verbs from the expression Params:
-
infinitive, the given verb
-
preterite, denote events that took place in the past
-
past_participle, form of a verb, ending in ‘ed’
-
&blk, block of code that may be run
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/verbs/conjugator.rb', line 40 def irregular(infinitive, preterite = nil, past_participle = nil, &blk) if block_given? # create new Verb object with infinitive and &blk irregular = ::Verbs::Verb.new infinitive, &blk else unless preterite && past_participle raise ArgumentError, 'Standard irregular verbs must specify preterite and past participle forms' end # create new Verb object with infinitive, 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
Find single terminal consonant with the infinitive Params:
-
infinitive, the given verb
59 60 61 |
# File 'lib/verbs/conjugator.rb', line 59 def single_terminal_consonant(infinitive) @single_terminal_consonants << infinitive end |