Class: RIO::RL::PathBase

Inherits:
URIBase show all
Defined in:
lib/rio/rl/path.rb

Direct Known Subclasses

Temp::Dir::RL, Temp::File::RL

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=

Methods included from Error::NotImplemented

#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

Constructor Details

This class inherits a constructor from RIO::RL::URIBase

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)
  #p sch,opq,whole
  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)
  #p "arg0_info_(#{arg0.inspect},#{args.inspect})"
  #p callstr('init_from_args_',arg0.inspect,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

#fspathObject



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

#schemeObject



63
64
65
# File 'lib/rio/rl/path.rb', line 63

def scheme() 
  uri.scheme || 'path' 
end

#to_sObject

end



95
96
97
# File 'lib/rio/rl/path.rb', line 95

def to_s()
  self.fspath
end

#urlObject



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

Returns:

  • (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