Sha256: 0f48cf2aa809387f57c0afe9a12a5c9683d964795d2f6a3be6151b25e4a92180
Contents?: true
Size: 388 Bytes
Versions: 29
Compression:
Stored size: 388 Bytes
Contents
# frozen_string_literal: true module ActionPolicy module Ext # Add underscore to String module StringUnderscore refine String do def underscore word = gsub(/::/, "/") word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.downcase! word end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems