Module: Rich::Pluralization::Core::String::Inflections

Included in:
String
Defined in:
lib/rich/pluralization/core/string/inflections.rb

Instance Method Summary collapse

Instance Method Details

#cp_case(s) ⇒ Object



16
17
18
# File 'lib/rich/pluralization/core/string/inflections.rb', line 16

def cp_case(s)
  send((:downcase unless s.dup.downcase!) || (:upcase unless s.dup.upcase!) || (:upcase_first unless s.dup.upcase_first!) || :to_s)
end

#cp_case!(s) ⇒ Object



24
25
26
# File 'lib/rich/pluralization/core/string/inflections.rb', line 24

def cp_case!(s)
  self == (result = cp_case(s))   ? nil : replace(result)
end

#pl(count = nil) ⇒ Object

– end



30
31
32
# File 'lib/rich/pluralization/core/string/inflections.rb', line 30

def pl(count = nil)
  Rich::Pluralization::Inflector.pluralize self, count
end

#upcase_firstObject

– start FIXME: these methods are also defined in rich_i18n



10
11
12
13
14
# File 'lib/rich/pluralization/core/string/inflections.rb', line 10

def upcase_first
  empty? ?
    self :
    self[0].chr.capitalize + self[1, size]
end

#upcase_first!Object



20
21
22
# File 'lib/rich/pluralization/core/string/inflections.rb', line 20

def upcase_first!
  self == (result = upcase_first) ? nil : replace(result)
end