Sha256: f8de0403c9898511e734c230bb87b243e9802bdc1112d03392ef2ded07e6fecd
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Rich module Support module Core module String module Inflections def upcase_first empty? ? self : self[0].chr.capitalize + self[1, size] end def copy_case(s) send((:downcase unless s.dup.downcase!) || (:upcase unless s.dup.upcase!) || (:upcase_first unless s.dup.upcase_first!) || :to_s) end alias_method :cp_case, :copy_case def upcase_first! self == (result = upcase_first) ? nil : replace(result) end def copy_case!(s) self == (result = cp_case(s)) ? nil : replace(result) end alias_method :cp_case!, :copy_case! def singularize! downcase == (result = singularize).downcase ? nil : replace(result) end def pluralize! downcase == (result = pluralize).downcase ? nil : replace(result) end def singular? !dup.singularize! end def plural? !singular? end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rich_support-0.1.2 | lib/rich/support/core/string/inflections.rb |
rich_support-0.1.1 | lib/rich/support/core/string/inflections.rb |