url = 'https://api.github.com/repos/orgName/final'
pieces = url.split('/')
p pieces
puts
puts pieces[-2]

--output:--
["https:", "", "api.github.com", "repos", "orgName", "final"]

orgName

-- 
Posted via http://www.ruby-forum.com/.