Class: ProgrammingIpsum::Inflector

Inherits:
Object
  • Object
show all
Includes:
Noun, Verb
Defined in:
lib/programming_ipsum/inflector.rb

Overview

An imperfect but close enough English inflector.

Defined Under Namespace

Modules: Noun, Verb

Instance Method Summary collapse

Methods included from Verb

#agreement_verb, #gerund_verb, #past_verb

Methods included from Noun

#plural_noun, #plural_possessive_noun, #possessive_noun

Instance Method Details

#article(word) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/programming_ipsum/inflector.rb', line 3

def article(word)
  if %w{a e i o u}.include?(word[0].downcase)
    "an #{word}"
  else
    "a #{word}"
  end
end