Class: Bootloader::BlsSections
- Inherits:
-
Object
- Object
- Bootloader::BlsSections
- Includes:
- Yast::I18n, Yast::Logger
- Defined in:
- src/lib/bootloader/bls_sections.rb
Overview
Represents available sections and handling of default BLS boot entry
Instance Attribute Summary collapse
-
#all ⇒ Array<String>
readonly
or an empty array.
-
#default ⇒ String
Title of default boot section.
Instance Method Summary collapse
-
#initialize ⇒ BlsSections
constructor
A new instance of BlsSections.
- #read ⇒ Object
-
#write ⇒ Object
writes default to system making it persistent.
Constructor Details
#initialize ⇒ BlsSections
Returns a new instance of BlsSections.
25 26 27 28 29 30 |
# File 'src/lib/bootloader/bls_sections.rb', line 25 def initialize textdomain "bootloader" @all = [] @default = "" end |
Instance Attribute Details
#all ⇒ Array<String> (readonly)
or an empty array
20 21 22 |
# File 'src/lib/bootloader/bls_sections.rb', line 20 def all @all end |
#default ⇒ String
Returns title of default boot section.
23 24 25 |
# File 'src/lib/bootloader/bls_sections.rb', line 23 def default @default end |
Instance Method Details
#read ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'src/lib/bootloader/bls_sections.rb', line 55 def read @data = read_entries @all = @data.map { |e| e["title"] if e["type"] == "type1" }.compact file = Bls..strip set = @data.find { |d| d["id"] == file } set ||= @data.first @default = set["title"] if set end |
#write ⇒ Object
writes default to system making it persistent
48 49 50 51 52 53 |
# File 'src/lib/bootloader/bls_sections.rb', line 48 def write return if @default.empty? set = @data.find { |d| d["title"] == @default } Bls.(set["id"]) if set end |