Class: EFIValidate::EALFParser
- Inherits:
-
Object
- Object
- EFIValidate::EALFParser
- Defined in:
- lib/efivalidate/ealf_parser.rb
Defined Under Namespace
Classes: EALFParseError
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ EALFParser
constructor
A new instance of EALFParser.
Constructor Details
#initialize(data) ⇒ EALFParser
Returns a new instance of EALFParser.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/efivalidate/ealf_parser.rb', line 7 def initialize(data) @header = EFIValidate::EALFHeader.read(data, 97) raise EALFParseError, 'File header magic mismatch.' unless @header.ealf_magic == EFIValidate::EALFHeader::EALF_MAGIC raise EALFParseError, 'Only SHA256 EALF is supported.' unless @header.ealf_hash_function == EFIValidate::EALFHeader::EALF_HASH_SHA256 @rows = [] @header.ealf_rows.times do @rows << EFIValidate::EALFRow.read(data, @header.row_size).tap { |row| row.header = @header } end end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
5 6 7 |
# File 'lib/efivalidate/ealf_parser.rb', line 5 def header @header end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
5 6 7 |
# File 'lib/efivalidate/ealf_parser.rb', line 5 def rows @rows end |
Class Method Details
.read(file) ⇒ Object
19 20 21 |
# File 'lib/efivalidate/ealf_parser.rb', line 19 def self.read(file) EFIValidate::EALFParser.new(File.open(file)) end |