Class: PageEz::Pluralization

Inherits:
Object
  • Object
show all
Defined in:
lib/page_ez/pluralization.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/page_ez/pluralization.rb', line 17

def plural?
  @word == pluralize && @word != singularize
end

#pluralizeObject



13
14
15
# File 'lib/page_ez/pluralization.rb', line 13

def pluralize
  @word.pluralize
end

#singular?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/page_ez/pluralization.rb', line 21

def singular?
  !plural?
end

#singularizeObject



9
10
11
# File 'lib/page_ez/pluralization.rb', line 9

def singularize
  @word.singularize
end