Class: VirtFS::VPathname

Inherits:
VfsRealPathname
  • Object
show all
Defined in:
lib/virtfs/v_pathname.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.getwdObject



3
4
5
# File 'lib/virtfs/v_pathname.rb', line 3

def self.getwd
  new(::Dir.getwd)
end

.glob(*args) ⇒ Object



11
12
13
14
# File 'lib/virtfs/v_pathname.rb', line 11

def self.glob(*args)
  return ::Dir.glob(args).collect { |p| new(p) } unless block_given?
  ::Dir.glob(*args).each { |p| yield(new(p)) }
end

.pwdObject



7
8
9
# File 'lib/virtfs/v_pathname.rb', line 7

def self.pwd
  getwd
end

Instance Method Details

#atimeObject

absolute? ascend



19
20
21
# File 'lib/virtfs/v_pathname.rb', line 19

def atime
  ::File.atime(to_path)
end

#binread(*args) ⇒ Object

basename



25
26
27
# File 'lib/virtfs/v_pathname.rb', line 25

def binread(*args)
  ::File.binread(to_path, *args)
end

#expand_path(dirstring = nil) ⇒ Object

binwrite birthtime blockdev? chardev? children chmod chown cleanpath ctime delete descend directory? dirname each_child each_entry each_filename each_line empty? entries eql? executable? executable_real? exist?



53
54
55
56
# File 'lib/virtfs/v_pathname.rb', line 53

def expand_path(dirstring = nil)
  return self if absolute?
  self.class.new(::File.expand_path(to_path, dirstring))
end

#file?Boolean

extname

Returns:

  • (Boolean)


60
61
62
# File 'lib/virtfs/v_pathname.rb', line 60

def file?
  ::File.file?(to_path)
end

#read(*args) ⇒ Object

find fnmatch fnmatch? freeze ftype grpowned? join lchmod lchown lstat make_link make_symlink mkdir mkpath mountpoint? mtime open opendir owned? parent pipe?



86
87
88
# File 'lib/virtfs/v_pathname.rb', line 86

def read(*args)
  ::File.open(to_path, "r") { |f| return f.read(*args) }
end