Sha256: 9010bce8aaf59df2d619e3107fedfc2f3a41086d58dff964ddf907e5862216bf

Contents?: true

Size: 263 Bytes

Versions: 2

Compression:

Stored size: 263 Bytes

Contents

class String

  # Translate a (class or module) name to a suitable method name.
  #
  #   My::CoolClass.name.methodize => "my__cool_class"
  #
  def methodize
    gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').gsub('::','__').downcase
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facets-2.4.3 lib/core/facets/string/methodize.rb
facets-2.4.4 lib/core/facets/string/methodize.rb