Sha256: 214a97bb2397b44ecaa5ef3cf9ba8887ff3287d89a66f88932e47477f9e67c56
Contents?: true
Size: 619 Bytes
Versions: 2
Compression:
Stored size: 619 Bytes
Contents
require 'uri' module URI # # Returns the +basename+ of the specified _uri_, unless the +basename+ is # +'trunk'+ then the +basename+ of the parent directory within the _uri_ # is returned. # # URI.repo_name('http://www.today.com/is/now') # => "now" # # URI.repo_name('svn://svn.repo.com/var/svn/awesome/trunk') # => # "awesome" # def URI.repo_name(uri) uri = URI.parse(uri) name = File.basename(uri.path) if name.empty? || name==File::SEPARATOR name = uri.host elsif name=='trunk' name = File.basename(File.dirname(uri.path)) end return name end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
repertoire-0.1.2 | lib/repertoire/extensions/uri.rb |
repertoire-0.1.1 | lib/repertoire/extensions/uri.rb |