Method: WWMD::URLParse#make_me_path

Defined in:
lib/wwmd/urlparse.rb

#make_me_pathObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/wwmd/urlparse.rb', line 69

def make_me_path
  @proto,tpath = @base.split(":",2)
  tpath ||= ""
  @params = tpath.clop
  tpath = tpath.clip
  if @actual.empty?
    a_path = tpath.split("/").reject { |x| x.empty? }
  else
    a_path = tpath.dirname.split("/").reject { |x| x.empty? }
  end
  @location = a_path.shift
  if @actual.clop
    @params = @actual.clop
    @actual = @actual.clip
  end
  a_path = [] if (@actual =~ (/^\//))
  b_path = @actual.split("/").reject { |x| x.empty? }
  a_path.pop if (a_path[-1] =~ /^\?/).kind_of?(Fixnum) && !b_path.empty?
  c_path = (a_path + @actual.split("/").reject { |x| x.empty? }).flatten
  d_path = []
  c_path.each do |x|
    (d_path.pop;next) if x == ".."
    next if (x == "." || x =~ /^\?/)
    d_path << x
  end
  return d_path
end