Class: CFA::Grub2::GrubCfg
- Inherits:
-
BaseModel
- Object
- BaseModel
- CFA::Grub2::GrubCfg
- 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
-
#boot_entries ⇒ Array<Hash>
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.
-
#initialize(file_handler: nil) ⇒ GrubCfg
constructor
A new instance of GrubCfg.
-
#sections ⇒ Array<String>
deprecated
Deprecated.
use instead boot_entries
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_entries ⇒ Array<Hash>
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.
65 66 67 |
# File 'lib/cfa/grub2/grub_cfg.rb', line 65 def boot_entries data end |
#sections ⇒ Array<String>
use instead boot_entries
Returns 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 |