Class: DriveInfo
- Inherits:
-
Object
- Object
- DriveInfo
- Defined in:
- lib/drive_info.rb
Class Method Summary collapse
- .get_drive_with_most_space_with_slash ⇒ Object
- .get_dvd_drives_as_win32ole ⇒ Object
- .md5sum_disk(dir) ⇒ Object
Class Method Details
.get_drive_with_most_space_with_slash ⇒ Object
21 22 23 24 25 |
# File 'lib/drive_info.rb', line 21 def self.get_drive_with_most_space_with_slash disks = WMI::Win32_LogicalDisk.find(:all) most_space = disks.sort_by{|d| d.FreeSpace.to_i}[-1] most_space.Name + "\\" end |
.get_dvd_drives_as_win32ole ⇒ Object
16 17 18 19 |
# File 'lib/drive_info.rb', line 16 def self.get_dvd_drives_as_win32ole disks = WMI::Win32_LogicalDisk.find(:all) disks.select{|d| d.Description =~ /CD-ROM/} # hope this works... end |
.md5sum_disk(dir) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/drive_info.rb', line 6 def self.md5sum_disk(dir) digest = Digest::MD5.new() files = Dir[dir + "VIDEO_TS/*.IFO"] files.sort.each{|f| digest << File.binread(f) } raise 'drive might not yet have disc in it? ' + dir unless files.length > 0 digest.hexdigest end |