Class: URI::Parser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/patch/uri-patch.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#orig_splitObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
# File 'lib/pione/patch/uri-patch.rb', line 44

alias :orig_split :split

#split(uri) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Handles to split special schemes's URI.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/pione/patch/uri-patch.rb', line 47

def split(uri)
  scheme = uri.split(":").first

  # special schemes
  case scheme
  when "local"
    path = uri[6..-1]
    return [scheme, nil, nil, nil, nil, path, nil, nil, nil]
  when "broadcast"
    rest = uri[10..-1]
    if rest == "//"
      return [scheme, nil, nil, nil, nil, nil, nil, nil, nil]
    end
  when "myftp"
    if uri[6] == "." or uri[6] == "~"
      path = uri[6..-1]
      return [scheme, nil, nil, nil, nil, path, nil, nil, nil]
    end
  end

  # other case
  return orig_split(uri)
end