Sha256: fa8e6b8b3c915b730ed51c75d15fbba5cd71538046fe7f6dbe83586713cf0b24
Contents?: true
Size: 491 Bytes
Versions: 7
Compression:
Stored size: 491 Bytes
Contents
class String # Converts a (class or module) name to a unix path. # # My::CoolClass.name.pathize #=> "my/cool_class" # #-- # Rails definition: # # gsub(/__/, '/'). # gsub(/::/, '/'). # gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). # gsub(/([a-z\d])([A-Z])/,'\1_\2'). # tr("-", "_"). # downcase #++ def pathize gsub(/([A-Z]+)([A-Z])/,'\1_\2'). gsub(/([a-z])([A-Z])/,'\1_\2'). gsub('__','/'). gsub('::','/'). downcase end end
Version data entries
7 entries across 7 versions & 1 rubygems