Class: PageEz::Pluralization
- Inherits:
-
Object
- Object
- PageEz::Pluralization
- Defined in:
- lib/page_ez/pluralization.rb
Instance Method Summary collapse
-
#initialize(word) ⇒ Pluralization
constructor
A new instance of Pluralization.
- #plural? ⇒ Boolean
- #pluralize ⇒ Object
- #singular? ⇒ Boolean
- #singularize ⇒ Object
Constructor Details
#initialize(word) ⇒ Pluralization
Returns a new instance of Pluralization.
5 6 7 |
# File 'lib/page_ez/pluralization.rb', line 5 def initialize(word) @word = word.to_s end |
Instance Method Details
#plural? ⇒ Boolean
17 18 19 |
# File 'lib/page_ez/pluralization.rb', line 17 def plural? @word == pluralize && @word != singularize end |
#pluralize ⇒ Object
13 14 15 |
# File 'lib/page_ez/pluralization.rb', line 13 def pluralize @word.pluralize end |
#singular? ⇒ Boolean
21 22 23 |
# File 'lib/page_ez/pluralization.rb', line 21 def singular? !plural? end |
#singularize ⇒ Object
9 10 11 |
# File 'lib/page_ez/pluralization.rb', line 9 def singularize @word.singularize end |