class CFA::Grub2::InstallDevice

Model representing configuration in file /etc/default/grub_installdevice

Constants

PATH

Public Class Methods

new(file_handler: nil) click to toggle source
Calls superclass method
# File lib/cfa/grub2/install_device.rb, line 43
def initialize(file_handler: nil)
  super(InstallDeviceParser, PATH, file_handler: file_handler)
end

Public Instance Methods

activate=(enabled) click to toggle source

sets special entry activate

# File lib/cfa/grub2/install_device.rb, line 88
def activate=(enabled)
  if enabled
    return if activate?

    data << "activate"
  else
    data.delete("activate")
  end
end
activate?() click to toggle source

Ask if special entry for activate is there

# File lib/cfa/grub2/install_device.rb, line 83
def activate?
  data.include?("activate")
end
add_device(dev) click to toggle source

Adds new install device. Does nothing if it is already there.

# File lib/cfa/grub2/install_device.rb, line 48
def add_device(dev)
  data << dev unless data.include?(dev)
end
devices() click to toggle source

@return [Array<String>] non-special devices from configuration

# File lib/cfa/grub2/install_device.rb, line 58
def devices
  res = data.dup
  res.delete("generic_mbr")
  res.delete("activate")

  res
end
generic_mbr=(enabled) click to toggle source

sets special entry generic_mbr

# File lib/cfa/grub2/install_device.rb, line 72
def generic_mbr=(enabled)
  if enabled
    return if generic_mbr?

    data << "generic_mbr"
  else
    data.delete("generic_mbr")
  end
end
generic_mbr?() click to toggle source

ask if special entry for generic_mbr is there

# File lib/cfa/grub2/install_device.rb, line 67
def generic_mbr?
  data.include?("generic_mbr")
end
remove_device(dev) click to toggle source

Removes install device. Does nothing if already not there.

# File lib/cfa/grub2/install_device.rb, line 53
def remove_device(dev)
  data.delete(dev)
end