Module: VimDatastoreFS

Defined in:
lib/fs/VimDatastoreFS/VimDatastoreFS.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(methodId) ⇒ Object (private)



167
168
169
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 167

def method_missing(methodId)
  raise "#{self.class}: #{methodId.id2name} is not supported"
end

Instance Method Details

#dsPath(p) ⇒ Object

def fs_fileClose(fobj)

return

end



141
142
143
144
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 141

def dsPath(p)
  return(p) if p[0, 1] == "["
  (path2key(normalizePath(p)))
end

#fileInfo(p) ⇒ Object



146
147
148
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 146

def fileInfo(p)
  (dsHash[dsPath(p)])
end

#fs_dirEntries(p) ⇒ Object



13
14
15
16
17
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 13

def fs_dirEntries(p)
  raise "Directory: #{p} does not exist" unless (fi = getFileInfo(p))
  raise "#{p} is not a directory" unless fi["fileType"] =~ /.*FolderFileInfo/
  (fi["dirEntries"])
end

#fs_fileDirectory?(p) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 28

def fs_fileDirectory?(p)
  return false unless (fi = getFileInfo(p))
  (fi["fileType"] =~ /.*FolderFileInfo/)
end

#fs_fileExists?(p) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 19

def fs_fileExists?(p)
  (getFileInfo(p).nil?)
end

#fs_fileFile?(p) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 23

def fs_fileFile?(p)
  return false unless (fi = getFileInfo(p))
  (fi["fileType"] != "FolderFileInfo")
end

#fs_fileMtime(p) ⇒ Object

def fs_fileAtime(p)

File.atime(p)

end

def fs_fileCtime(p)

File.ctime(p)

end



46
47
48
49
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 46

def fs_fileMtime(p)
  raise "File: #{p} does not exist" unless (fi = getFileInfo(p))
  (fi["modification"])
end

#fs_fileSize(p) ⇒ Object



33
34
35
36
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 33

def fs_fileSize(p)
  raise "File: #{p} does not exist" unless (fi = getFileInfo(p))
  (fi["fileSize"])
end

#fs_initObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 2

def fs_init
  # raise "Object dobj (#{dobj.class.to_s}) is not a MiqVimDataStore object" if [email protected]_of? MiqVimDataStore

  @fsType = "VimDatastoreFS"
  @fsId = @dobj.name
  @volName = @dobj.name

  @rootStr = "[#{@dobj.name}]"
  @dsHash = nil
end

#resetObject



150
151
152
# File 'lib/fs/VimDatastoreFS/VimDatastoreFS.rb', line 150

def reset
  @dsHash = nil
end