Sha256: bfddb24b4229a426e351c6ef643a9d2ebc8caf9b32314d1fcb8cf5be2fab3216
Contents?: true
Size: 388 Bytes
Versions: 8
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
8 entries across 8 versions & 1 rubygems