Class: CFA::Grub2::GrubCfg

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cfa/grub2/grub_cfg.rb

Overview

Represents generated grub configuration at /boot/grub2/grub.cfg Main features:

  • List of generated sections including translations

Defined Under Namespace

Classes: Parser

Constant Summary collapse

PATH =
"/boot/grub2/grub.cfg"

Instance Method Summary collapse

Constructor Details

#initialize(file_handler: nil) ⇒ GrubCfg

Returns a new instance of GrubCfg.



48
49
50
# File 'lib/cfa/grub2/grub_cfg.rb', line 48

def initialize(file_handler: nil)
  super(Parser, PATH, file_handler: file_handler)
end

Instance Method Details

#boot_entriesArray<Hash>

Note:

Some entries are not in fact bootable, such as the

on screen and ‘path:` whole path usable for grub2-set-default including also submenu part of path “run snaper rollback” hint-only entry on SUSE. They are ignored. As a hack, they are recognized by double quote delimiters while the regular entries use single quotes.

Returns:

  • (Array<Hash>)

    return boot entries containing ‘title:` as shown



65
66
67
# File 'lib/cfa/grub2/grub_cfg.rb', line 65

def boot_entries
  data
end

#sectionsArray<String>

Deprecated.

use instead boot_entries

Returns sections from grub.cfg in order as they appear.

Returns:

  • (Array<String>)

    sections from grub.cfg in order as they appear



54
55
56
# File 'lib/cfa/grub2/grub_cfg.rb', line 54

def sections
  data.map { |p| p[:title] }
end