Sha256: 64a350b929ae2550efb9573df86fd10191ae6a169f78b4282bcb20920bfe612e
Contents?: true
Size: 341 Bytes
Versions: 7
Compression:
Stored size: 341 Bytes
Contents
# Custom enhancements class String def underscore gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end def humanize(options = { capitalize: true }) s = underscore.tr('_', ' ') s = s.capitalize if options[:capitalize] s end end
Version data entries
7 entries across 7 versions & 2 rubygems