Module: RIO::Ops::Dir::Existing

Includes:
Cp::Dir::Input, Cp::Dir::Output, ExistOrNot, FileOrDir::Existing
Included in:
Dir::Existing
Defined in:
lib/rio/ops/dir.rb,
lib/rio/ops/dir.rb

Instance Method Summary collapse

Methods included from Cp::Dir::Output

#<, #<<

Methods included from Cp::Util::InOut

#cpclose, #cpclose0

Methods included from Cp::Dir::Input

#>, #>>

Methods included from FileOrDir::Existing

#basename=, #chmod, #chown, #dirname=, #extname=, #filename=, #mountpoint?, #must_exist, #realpath, #rename, #rename!, #ss_type?

Instance Method Details

#chdir(*args, &block) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/rio/ops/dir.rb', line 94

def chdir(*args,&block) 
  if block_given?
    fs.chdir(self.to_s,*args) { |dir|
      yield new_rio('.')
    }
  else
    fs.chdir(self.path,*args)
    return new_rio('.')
  end
  self
end

#empty?Boolean

Returns:

  • (Boolean)


81
# File 'lib/rio/ops/dir.rb', line 81

def empty?() self.to_a.empty? end

#ensure_rio_cx(arg0) ⇒ Object



106
107
108
109
# File 'lib/rio/ops/dir.rb', line 106

def ensure_rio_cx(arg0)
  return arg0 if arg0.kind_of?(::RIO::Rio)
  new_rio_cx(arg0)
end

#glob(*args, &block) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/rio/ops/dir.rb', line 111

def glob(*args,&block) 
  chdir do
    if block_given?
      fs.glob(*args) do |ent|
        yield new_rio_cx(self,ent)
      end
    else
      return fs.glob(*args).map { |ent| new_rio_cx(self,ent) }
    end
  end
end

#mkdir(*args) ⇒ Object



82
# File 'lib/rio/ops/dir.rb', line 82

def mkdir(*args) self end

#mkpath(*args) ⇒ Object



83
# File 'lib/rio/ops/dir.rb', line 83

def mkpath(*args) self end

#rmdir(*args) ⇒ Object Also known as: delete



84
85
86
87
# File 'lib/rio/ops/dir.rb', line 84

def rmdir(*args) 
  fs.rmdir(self.path,*args); 
  softreset()
end

#rmtree(*args) ⇒ Object Also known as: delete!



88
# File 'lib/rio/ops/dir.rb', line 88

def rmtree(*args) fs.rmtree(self.path,*args); softreset() end

#selective?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/rio/ops/dir.rb', line 78

def selective?
  %w[entry_sel stream_sel stream_nosel].any? { |k| cx.has_key?(k) }
end