class Diskman::Device
Attributes
name[R]
path[R]
Public Class Methods
new(name)
click to toggle source
# File lib/diskman/device.rb, line 6 def initialize(name) @name = name @path = '/dev/' + name end
Public Instance Methods
get_fdisk_command()
click to toggle source
# File lib/diskman/device.rb, line 11 def get_fdisk_command 'sudo fdisk %s' % @path end
get_mkfs_command(fs)
click to toggle source
# File lib/diskman/device.rb, line 15 def get_mkfs_command(fs) 'sudo mkfs.%s %s' % [fs, @path] end
get_write_command(path, bytes)
click to toggle source
# File lib/diskman/device.rb, line 19 def get_write_command(path, bytes) dd = 'sudo dd if="%s" of="%s" bs=%dK status=progress' dd % [path, @path, 4096] end
to_s()
click to toggle source
# File lib/diskman/device.rb, line 24 def to_s @path end
Private Instance Methods
<=>(o)
click to toggle source
# File lib/diskman/device.rb, line 30 def <=>(o) @path <=> o.path end