Sha256: c3b95c9ce8b6992a6efa1b9b89a22334f2d637b13842d83bd9b98d1a023d4d0a

Contents?: true

Size: 934 Bytes

Versions: 5

Compression:

Stored size: 934 Bytes

Contents

module Rich
  module Pluralization
    module Core
      module String
        module Inflections
          
          # -- start FIXME: these methods are also defined in rich_i18n
        
          def upcase_first
            empty? ?
              self :
              self[0].chr.capitalize + self[1, size]
          end
  
          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
  
          def upcase_first!
            self == (result = upcase_first) ? nil : replace(result)
          end
  
          def cp_case!(s)
            self == (result = cp_case(s))   ? nil : replace(result)
          end
          
          # -- end
  
          def pl(count = nil)
            Rich::Pluralization::Inflector.pluralize self, count
          end
                
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rich_pluralization-1.0.6 lib/rich/pluralization/core/string/inflections.rb
rich_pluralization-1.0.5 lib/rich/pluralization/core/string/inflections.rb
rich_pluralization-1.0.4 lib/rich/pluralization/core/string/inflections.rb
rich_pluralization-1.0.3 lib/rich/pluralization/core/string/inflections.rb
rich_pluralization-1.0.2 lib/rich/pluralization/core/string/inflections.rb