Class: MountPoints

Inherits:
Object
  • Object
show all
Defined in:
lib/mountpoints.rb

Constant Summary collapse

REMOTE_FILE_SYSTEMS =
["autofs", "cifs", "nfs", "nfs4"]
SPECIAL_FILE_SYSTEMS =
["proc", "sysfs", "devtmpfs", "tmpfs", "fuse.gvfs-fuse-daemon"]
LOCAL_FILE_SYSTEMS =
["ext2", "ext3", "ext4", "reiserfs", "btrfs", "vfat", "xfs", "jfs"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system) ⇒ MountPoints

Returns a new instance of MountPoints.



39
40
41
# File 'lib/mountpoints.rb', line 39

def initialize(system)
  @mounts = parse_mounts(system.read_file("/proc/mounts"))
end

Instance Attribute Details

#mountsObject (readonly)

Returns the value of attribute mounts.



35
36
37
# File 'lib/mountpoints.rb', line 35

def mounts
  @mounts
end

Instance Method Details

#allObject



55
56
57
# File 'lib/mountpoints.rb', line 55

def all
  @mounts.keys
end

#localObject



51
52
53
# File 'lib/mountpoints.rb', line 51

def local
  @mounts.select { |_fs_file, fs_vfstype| local_fs?(fs_vfstype) }.keys
end

#remoteObject



47
48
49
# File 'lib/mountpoints.rb', line 47

def remote
  @mounts.select { |_fs_file, fs_vfstype| remote_fs?(fs_vfstype) }.keys
end

#specialObject



43
44
45
# File 'lib/mountpoints.rb', line 43

def special
  @mounts.select { |_fs_file, fs_vfstype| special_fs?(fs_vfstype) }.keys
end