Class: Strings::Inflection::Noun
- Defined in:
- lib/strings/inflection/noun.rb
Instance Attribute Summary
Attributes inherited from Term
Instance Method Summary collapse
-
#+(other_word) ⇒ CombinedNoun
Combine this noun with another word.
-
#plural ⇒ Object
Inflect a word to its plural form.
-
#singular ⇒ Object
Inflect a word to its singular form.
-
#uncountable? ⇒ Boolean
private
Check if word is uncountable.
Methods inherited from Term
[], #find_match, #initialize, #plural?, #singular?, #to_s
Constructor Details
This class inherits a constructor from Strings::Inflection::Term
Instance Method Details
#+(other_word) ⇒ CombinedNoun
Combine this noun with another word
65 66 67 |
# File 'lib/strings/inflection/noun.rb', line 65 def +(other_word) CombinedNoun.new([word, other_word]) end |
#plural ⇒ Object
Inflect a word to its plural form
50 51 52 53 54 55 |
# File 'lib/strings/inflection/noun.rb', line 50 def plural return word if word.to_s.empty? find_match(Inflection.configuration.plurals[:noun]) || (uncountable? && word) || find_match(Nouns.plurals) || word end |
#singular ⇒ Object
Inflect a word to its singular form
33 34 35 36 37 38 |
# File 'lib/strings/inflection/noun.rb', line 33 def singular return word if word.to_s.empty? find_match(Inflection.configuration.singulars[:noun]) || (uncountable? && word) || find_match(Nouns.singulars) || word end |
#uncountable? ⇒ Boolean
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.
Check if word is uncountable
18 19 20 21 |
# File 'lib/strings/inflection/noun.rb', line 18 def uncountable? Inflection.configuration.uncountables[:noun].include?(word.downcase) || Nouns.uncountable.include?(word.downcase) end |