lib/core/facets/string/pathize.rb in facets-2.4.4 vs lib/core/facets/string/pathize.rb in facets-2.4.5
- old
+ new
@@ -1,12 +1,16 @@
class String
# Converts a (class or module) name to a unix path.
#
- # My::CoolClass.name.pathize #=> "/my/cool_class"
+ # My::CoolClass.name.pathize #=> "my/cool_class"
#
def pathize
- gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').gsub('::','/').downcase
+ gsub(/([A-Z]+)([A-Z])/,'\1_\2').
+ gsub(/([a-z])([A-Z])/,'\1_\2').
+ gsub('__','/').
+ gsub('::','/').
+ downcase
end
end