Module: Rich::I18n::Core::String::Inflections

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

Instance Method Summary collapse

Instance Method Details

#cp_case(s) ⇒ Object



16
17
18
# File 'lib/rich/i18n/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/i18n/core/string/inflections.rb', line 24

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

#pluralize!Object



34
35
36
# File 'lib/rich/i18n/core/string/inflections.rb', line 34

def pluralize!
  downcase == (result = pluralize).downcase   ? nil : replace(result)
end

#singularize!Object

– end



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

def singularize!
  downcase == (result = singularize).downcase ? nil : replace(result)
end

#upcase_firstObject

– start FIXME: these methods are also defined in rich_pluralization



10
11
12
13
14
# File 'lib/rich/i18n/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/i18n/core/string/inflections.rb', line 20

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