lib/rio/rl/path.rb in rio-0.3.7 vs lib/rio/rl/path.rb in rio-0.3.8
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===============================================================================
-# Copyright (c) 2005, Christopher Kleckner
+# Copyright (c) 2005, 2006 Christopher Kleckner
# All rights reserved
#
# This file is part of the Rio library for ruby.
#
# Rio is free software; you can redistribute it and/or modify
@@ -20,11 +20,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# ===============================================================================
#++
#
# To create the documentation for Rio run the command
-# rake rdoc
+# ruby build_doc.rb
# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
#
# Suggested Reading
# * RIO::Doc::SYNOPSIS
# * RIO::Doc::INTRO
@@ -45,10 +45,11 @@
RIOSCHEME = 'path'
HOST = URI::REGEXP::PATTERN::HOST
SCHEME = URI::REGEXP::PATTERN::SCHEME
+ #attr :fs
def initialize(pth,*args)
@host = nil # host or nil
@fspath = nil
case pth
@@ -69,17 +70,22 @@
@host = $1 || ''
@fspath = $2 ? RL.url2fs($2) : '/'
else
self.fspath = pth
end
- args = _get_base_from_args(args)
+ args = _get_opts_from_args(args)
self.join(*args) unless args.empty?
unless self.absolute? or @base
@base = RL.fs2url(::Dir.getwd)+'/'
end
@fspath.sub!(%r|/\.$|,'/')
+ #@fs = openfs_
+ super
end
+ def openfs_
+ RIO::FS::Native.create()
+ end
def pathroot()
return nil unless absolute?
rrl = self.clone
if self.urlpath =~ %r%^(/[a-zA-Z]):%
$1+':/'
@@ -87,19 +93,25 @@
'/'
end
end
include PathMethods
- def _get_base_from_args(args)
+ def _get_opts_from_args(args)
@base = nil
- if !args.empty? and args[-1].kind_of?(::Hash) and (b = args.pop[:base])
- @base = case b
- when %r%^file://(#{HOST})?(/.*)?$% then b
- when %r%^/% then b
- else RL.fs2url(::Dir.getwd)+'/'+b
- end
- @base.squeeze('/')
+ if !args.empty? and args[-1].kind_of?(::Hash)
+ opts = args.pop
+ if b = opts[:base]
+ @base = case b
+ when %r%^file://(#{HOST})?(/.*)?$% then b
+ when %r%^/% then b
+ else RL.fs2url(::Dir.getwd)+'/'+b
+ end
+ @base.squeeze('/')
+ end
+ if fs = opts[:fs]
+ @fs = fs
+ end
end
args
end
def base(arg=nil)
self.base = arg unless arg.nil?
@@ -167,13 +179,9 @@
when 'file' then [whole]
else [opq]
end
end
-
- def dirname()
- Impl::U.dirname(self.path_no_slash)
- end
end
end
end