Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#plural?Boolean

I’m wondering the interface of linguistic, but I don’t wanna use ActiveSupport ‘box’.en.plural #=> ‘boxes’ ‘box’.en.plural_noun #=> ‘boxes’ ‘boxes’.en.plural #=> ‘box’ ‘boxes’.en.plural_noun #=> ‘boxess’ ‘carp’.en.plural #=> ‘carp’ ‘carp’.en.plural_noun #=> ‘carp’ See spec.

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/core_ext/string.rb', line 10

def plural?
  if self == self.en.plural # e.g. carp
    true
  else
    self.en.plural == self.en.plural_noun ? false : true
  end
end