Sha256: 8de4bb7337f985588ea6e051c8af83bec1392825386d1b417f22bdbdc57997d0
Contents?: true
Size: 824 Bytes
Versions: 2
Compression:
Stored size: 824 Bytes
Contents
class String # See gem Facets String#pathize # Transforms a namespace, i.e. a class or module name, into a viable # file path. # # "ExamplePathize".pathize #=> "example_pathize" # "ExamplePathize::Example".pathize #=> "example_pathize/example" # # Compare this method to {String#modulize) and {String#methodize). # def pathize gsub(/([A-Z]+)([A-Z])/,'\1_\2'). gsub(/([a-z])([A-Z])/,'\1_\2'). gsub('__','/'). gsub('::','/'). gsub(/\s+/, ''). # spaces are bad form gsub(/[?%*:|"<>.]+/, ''). # reserved characters downcase end # Compare to Rails definition: # # gsub(/__/, '/'). # gsub(/::/, '/'). # gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). # gsub(/([a-z\d])([A-Z])/,'\1_\2'). # tr("-", "_"). # downcase # end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blood_contracts-0.2.1 | lib/extensions/string.rb |
blood_contracts-0.2.0 | lib/extensions/string.rb |