Sha256: c2ee39e99f55365a6822d32460ae06cc376a3c0a50ee7f85c9004bcb81010dae
Contents?: true
Size: 793 Bytes
Versions: 8
Compression:
Stored size: 793 Bytes
Contents
module LedgerSync module Util module StringHelpers extend self def camelcase(str) str.to_s.split('/').map { |e| e.split('_').collect(&:capitalize).map(&method(:inflect)).join }.join('::') end # def underscore!(str) # str.gsub!(/(.)([A-Z])/, '\1_\2') # str.downcase! # end def underscore!(str) str.gsub!(/::/, '/') str.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') str.gsub!(/([a-z\d])([A-Z])/, '\1_\2') str.tr!('-', '_') str.downcase! end def underscore(str) str.dup.tap(&method(:underscore!)) end def inflect(str) case str.downcase when 'quickbooks' 'QuickBooks' else str end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems