Class: RIO::RL::PathBase
Constant Summary
collapse
- RESET_STATE =
'Path::Reset'
Constants inherited
from URIBase
URIBase::HOST, URIBase::SCHEME
Constants inherited
from WithPath
WithPath::HOST, WithPath::SCHEME
Instance Attribute Summary
Attributes inherited from URIBase
#uri
Attributes inherited from Base
#fs
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from URIBase
#_get_base_from_arg, #_get_opts_from_args, #absolute?, #base, #base=, #host, #host=, #init_from_args_, #initialize, #initialize_copy, #opaque, #openfs_, #path, #path=, #pathroot, #urlpath, #urlpath=, #urlroot
Methods inherited from WithPath
#_build, #_parts, #_uri, #abs, #base, #basename, #dirname, #filename, #fspath=, #fspath_no_slash, #host, #host=, #is_root?, #merge, #opaque, #openfs_, #path, #path=, #path_no_slash, #pathdepth, #pathroot, #route_from, #route_to, #split, #uri, #uri_from_string_, #urlpath, #urlpath=
#nodef
Methods inherited from Base
#==, #===, #=~, #callstr, #close, #escape, #fs2url, #initialize, #initialize_copy, is_riorl?, #length, #openfs_, parse, #path, #rl, split_riorl, subscheme, #to_rl, #unescape, #url2fs
Class Method Details
.splitrl(s) ⇒ Object
98
99
100
101
102
103
104
105
|
# File 'lib/rio/rl/path.rb', line 98
def self.splitrl(s)
sch,opq,whole = split_riorl(s)
case sch
when 'file' then [whole]
else [opq]
end
end
|
Instance Method Details
#arg0_info_(arg0, *args) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/rio/rl/path.rb', line 46
def arg0_info_(arg0,*args)
vuri,vbase,vfs = nil,nil,nil
case arg0
when RIO::Rio, URIBase, ::URI
return super
when ::String
vuri = uri_from_string_(RL.fs2url(arg0)) || ::URI.parse(RL.fs2url(arg0))
else
raise(ArgumentError,"'#{arg0}'[#{arg0.class}] can not be used to create a Rio")
end
[vuri,vbase,vfs]
end
|
#build_arg0_(path_str) ⇒ Object
60
61
62
|
# File 'lib/rio/rl/path.rb', line 60
def build_arg0_(path_str)
RL.url2fs(path_str)
end
|
80
81
82
83
84
85
86
|
# File 'lib/rio/rl/path.rb', line 80
def fspath()
if use_host?
'//' + uri.host + RL.url2fs(self.urlpath)
else
RL.url2fs(self.urlpath)
end
end
|
#join(*args) ⇒ Object
76
77
78
79
|
# File 'lib/rio/rl/path.rb', line 76
def join(*args)
return self if args.empty?
join_(args.map{ |arg| RL.fs2url(arg.to_s)})
end
|
63
64
65
|
# File 'lib/rio/rl/path.rb', line 63
def scheme()
uri.scheme || 'path'
end
|
95
96
97
|
# File 'lib/rio/rl/path.rb', line 95
def to_s()
self.fspath
end
|
66
67
68
69
70
|
# File 'lib/rio/rl/path.rb', line 66
def url
str = uri.to_s
str = scheme + ':' +str unless uri.scheme
str
end
|
#use_host? ⇒ Boolean
71
72
73
74
|
# File 'lib/rio/rl/path.rb', line 71
def use_host?
hst = uri.host
!(hst.nil? || hst.empty? || hst == 'localhost')
end
|