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



139
140
141
142
143
144
145
146
147
148
149
# File 'lib/rio/ops/dir.rb', line 139

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)


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

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

#ensure_rio_cx(arg0) ⇒ Object



151
152
153
154
# File 'lib/rio/ops/dir.rb', line 151

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

#glob(*args, &block) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
# File 'lib/rio/ops/dir.rb', line 156

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



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

def mkdir(*args) self end

#mkpath(*args) ⇒ Object



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

def mkpath(*args) self end

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



129
130
131
132
# File 'lib/rio/ops/dir.rb', line 129

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

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



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

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

#selective?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/rio/ops/dir.rb', line 123

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