Module: Slotify::InflectionHelper

Extended by:
ActiveSupport::Concern
Included in:
Partial, Value
Defined in:
lib/slotify/concerns/inflection_helper.rb

Instance Method Summary collapse

Instance Method Details

#plural?(str) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/slotify/concerns/inflection_helper.rb', line 14

def plural?(str)
  !singular?(str)
end

#singular?(str) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/slotify/concerns/inflection_helper.rb', line 5

def singular?(str)
  str = str.to_s
  str.singularize == str && str.pluralize != str
end

#singularize(sym) ⇒ Object



10
11
12
# File 'lib/slotify/concerns/inflection_helper.rb', line 10

def singularize(sym)
  sym.to_s.singularize.to_sym
end