Module: RIO::RL

Defined in:
lib/rio/rl/fs2url.rb,
lib/rio/rl/ioi.rb,
lib/rio/rl/ioi.rb,
lib/rio/rl/uri.rb,
lib/rio/rl/base.rb,
lib/rio/rl/path.rb,
lib/rio/rl/chmap.rb,
lib/rio/rl/builder.rb,
lib/rio/rl/withpath.rb,
lib/rio/rl/withpath.rb,
lib/rio/rl/withpath.rb,
lib/rio/rl/pathmethods.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: PathMethods, PathUtil Classes: Base, Builder, IOIBase, PathBase, SysIOBase, URIBase, WithPath

Constant Summary collapse

SCHEME =
'rio'
SCHC =
SCHEME+':'
SPLIT_RIORL_RE =
%r{\A([a-z][a-z]+)(?:(:)(.*))?\Z}.freeze
SUBSEPAR =
':'
CHMAP =
{ 
  '_'    => 'sysio',
  '-'    => 'stdio',
  '='    => 'stderr',
  '"'    => 'strio',
  '?'    => 'temp',
  '['    => 'aryio',
  '`'    => 'cmdio',
  '|'    => 'cmdpipe',
  '#'    => 'fd',

  ?_    => 'sysio',
  ?-    => 'stdio',
  ?=    => 'stderr',
  ?"    => 'strio',
  ??    => 'temp',
  ?[    => 'aryio',
  ?`    => 'cmdio',
  ?|    => 'cmdpipe',
  ?#    => 'fd',
  ?z    => 'zipfile',
}.freeze
PESCAPE =
Regexp.new("[^-_.!~*'()a-zA-Z0-9;?:@&=+$,]",false, 'N').freeze
ESCAPE =
Regexp.new("[^-_.!~*'()a-zA-Z0-9;\/?:@&=+$,]",false, 'N').freeze

Class Method Summary collapse

Class Method Details

.escape(pth, esc = ESCAPE) ⇒ Object



46
47
48
# File 'lib/rio/rl/fs2url.rb', line 46

def escape(pth,esc=ESCAPE)
  ::URI.escape(pth,esc)
end

.fs2url(pth) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/rio/rl/fs2url.rb', line 55

def fs2url(pth)
  #pth.sub!(/^[a-zA-Z]:/,'')
  pth = URI.escape(pth,ESCAPE)
  pth = '/' + pth if pth =~ /^[a-zA-Z]:/
  pth
  #      (Local::SEPARATOR == '/' ? pth : pth.gsub(Local::SEPARATOR,%r|/|))
end

.fs2urls(*args) ⇒ Object



52
53
54
# File 'lib/rio/rl/fs2url.rb', line 52

def fs2urls(*args)
  args.map{ |pth| fs2url(pth) }
end

.getwdObject



75
76
77
78
# File 'lib/rio/rl/fs2url.rb', line 75

def getwd()
  #::URI::FILE.build({:path => fs2url(::Dir.getwd)+'/'})
  ::URI::FILE.build({:path => fs2url(::Dir.getwd)})
end

.unescape(pth) ⇒ Object



49
50
51
# File 'lib/rio/rl/fs2url.rb', line 49

def unescape(pth)
  ::URI.unescape(pth)
end

.url2fs(pth) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rio/rl/fs2url.rb', line 63

def url2fs(pth)
#      pth = pth.chop if pth.length > 1 and pth[-1] == ?/      cwd = RIO::RL.fs2url(::Dir.getwd)

  #pth = pth.chop if pth != '/' and pth[-1] == ?/
  pth = ::URI.unescape(pth)
  if pth =~ %r#^/[a-zA-Z]:#
    pth = pth[1..-1] 
  end
  pth
#      (Local::SEPARATOR == '/' ? pth : pth.gsub(%r|/|,Local::SEPARATOR))
end