lib/rio/path.rb in rio-0.3.8 vs lib/rio/path.rb in rio-0.3.9
- old
+ new
@@ -1,8 +1,8 @@
#--
# ===============================================================================
-# Copyright (c) 2005, 2006 Christopher Kleckner
+# Copyright (c) 2005,2006,2007 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
@@ -21,23 +21,21 @@
# ===============================================================================
#++
#
# To create the documentation for Rio run the command
# ruby build_doc.rb
-# from the distribution directory. Then point your browser at the 'doc/rdoc' directory.
+# from the distribution directory.
#
# Suggested Reading
# * RIO::Doc::SYNOPSIS
# * RIO::Doc::INTRO
# * RIO::Doc::HOWTO
+# * RIO::Doc::EXAMPLES
# * RIO::Rio
#
-# <b>Rio is pre-alpha software.
-# The documented interface and behavior is subject to change without notice.</b>
-# cell phone number: 954-6752.
require 'rio/state'
require 'rio/ops/path'
require 'rio/ops/symlink'
require 'rio/cp'
module RIO
@@ -47,25 +45,31 @@
# nil? or empty? => Emp
# else => Sin
class Empty < State::Base
include Ops::Path::Empty
def check?() fspath.nil? or fspath.empty? end
- def [](*args)
+
+ private
+
+ def _assume_cwd()
self.rl = Path::RL.new('.')
- softreset[*args]
+ self.softreset
end
- def each(&block)
- self.rl = Path::RL.new('.')
- softreset.each(&block)
+ def _assume_stdio()
+ require 'rio/scheme/stdio'
+ self.rl = RIO::StdIO::RL.new
+ self.softreset
end
- def read(*args)
- self.rl = Path::RL.new('.')
- softreset.read(*args)
- end
- def get(*args)
- self.rl = Path::RL.new('.')
- softreset.get(*args)
- end
+
+ public
+
+ def [](*args) _assume_cwd[*args] end
+ def each(&block) _assume_cwd.each(&block) end
+ def read(*args) _assume_cwd.read(*args) end
+ def get(*args) _assume_cwd.get(*args) end
+
+ def gets(*args) _assume_stdio.chomp.gets(*args) end
+
def when_missing(sym,*args) gofigure(sym,*args) end
end
# Primary State for Rio as path manipulator
class Str < State::Base