Module: ProgrammingIpsum::Inflector::Verb
- Included in:
- ProgrammingIpsum::Inflector
- Defined in:
- lib/programming_ipsum/inflector.rb
Overview
Instance Method Summary collapse
-
#agreement_verb(word) ⇒ Object
reference smrtenglish.com/me/lesson/2531.
-
#gerund_verb(word) ⇒ Object
no way to check syllables in ruby, so this has some issues.
- #past_verb(word) ⇒ Object
Instance Method Details
#agreement_verb(word) ⇒ Object
reference smrtenglish.com/me/lesson/2531
71 72 73 74 75 76 77 78 79 |
# File 'lib/programming_ipsum/inflector.rb', line 71 def agreement_verb(word) if word =~ /(ss|sh|ch|x|o|z)$/ word + 'es' elsif word =~ /[^aeiou]y$/ word[0..-2] + 'ies' else word + 's' end end |
#gerund_verb(word) ⇒ Object
no way to check syllables in ruby, so this has some issues.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/programming_ipsum/inflector.rb', line 42 def gerund_verb(word) if word =~ /[^oey]e$/ word[0..-2] + 'ing' elsif word[-1] == 'c' word + 'king' elsif word =~ /[^aeiou][aeiou][^aeiouxw]$/ word + word[-1] + 'ing' else word + 'ing' end end |
#past_verb(word) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/programming_ipsum/inflector.rb', line 54 def past_verb(word) if word[-1] == 'e' word + 'd' elsif word[-1] == 'c' word + 'ked' elsif word =~ /[aeiou][aeiou][^aeiou]$/ word + 'ed' elsif word =~ /[aeiou]([^aeiou])$/ word + $1 + "ed" elsif word =~ /[aeiou]l$/ word + 'led' else word + 'ed' end end |