Module: RVC::Path

Defined in:
lib/rvc/path.rb

Class Method Summary collapse

Class Method Details

.parse(path) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rvc/path.rb', line 23

def self.parse path
  if path.empty?
    return [[], false, false]
  elsif path == '/'
    return [[], true, true]
  else
    els = path.split '/'
    trailing_slash = path[-1..-1] == '/'
    absolute = !els[0].nil? && els[0].empty?
    els.shift if absolute
    [els, absolute, trailing_slash]
  end
end