Sha256: 81676c3a31f57ea3b76204ef7c4f152d62b009717cc21e2b1593c9353073d125
Contents?: true
Size: 426 Bytes
Versions: 12
Compression:
Stored size: 426 Bytes
Contents
# frozen_string_literal: true module Bckbn module CoreExt module StringExt refine String do def underscore copy = dup copy.gsub("::", "/") copy.gsub!(/([A-Z])(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) do (::Regexp.last_match(1) || ::Regexp.last_match(2)) << "_" end copy.tr!("-", "_") copy.downcase! end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems