Sha256: 3b7f2cb13fde9ec4ecc487329516ff924ec36913f3b75ff730b4140c89a7a1eb

Contents?: true

Size: 407 Bytes

Versions: 14

Compression:

Stored size: 407 Bytes

Contents

require 'facets/string/pathize'

class Module

  # Converts a class name to a unix path
  #
  # Examples
  #   CoolClass.pathize       #=> "cool_class"
  #   My::CoolClass.pathize   #=> "my/cool_class"
  #
  def pathize
    name.pathize
    #to_s.
    #  gsub(/::/, '/').
    #  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    #  gsub(/([a-z\d])([A-Z])/,'\1_\2').
    #  tr("-", "_").
    #  downcase
  end

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
facets-2.8.4 lib/core/facets/module/pathize.rb
facets-2.8.3 lib/core/facets/module/pathize.rb
facets-2.8.2 lib/core/facets/module/pathize.rb
facets-2.8.1 lib/core/facets/module/pathize.rb
facets-2.8.0 lib/core/facets/module/pathize.rb
facets-2.7.0 lib/core/facets/module/pathize.rb
facets-2.6.0 lib/core/facets/module/pathize.rb
facets-2.4.3 lib/core/facets/module/pathize.rb
facets-2.4.4 lib/core/facets/module/pathize.rb
facets-2.5.1 lib/core/facets/module/pathize.rb
facets-2.5.0 lib/core/facets/module/pathize.rb
facets-2.4.5 lib/core/facets/module/pathize.rb
facets-2.5.2 lib/core/facets/module/pathize.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/module/pathize.rb