Method: Capybara::Helpers.declension

Defined in:
lib/capybara/helpers.rb

.declension(singular, plural, count) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A poor man's pluralize. Given two declensions, one singular and one plural, as well as a count, this will pick the correct declension. This way we can generate grammatically correct error message.

Parameters:

  • singular (String)

    The singular form of the word

  • plural (String)

    The plural form of the word

  • count (Integer)

    The number of items



69
70
71
# File 'lib/capybara/helpers.rb', line 69

def declension(singular, plural, count)
  count == 1 ? singular : plural
end