Class: ELFTools::Note::Note
- Inherits:
-
Object
- Object
- ELFTools::Note::Note
- Defined in:
- lib/elftools/note.rb
Overview
Class of a note.
Instance Attribute Summary collapse
-
#header ⇒ ELFTools::Structs::ELF_Nhdr
readonly
Note header.
-
#offset ⇒ Integer
readonly
Address of this note start, includes note header.
-
#stream ⇒ #pos=, #read
readonly
Streaming object.
Instance Method Summary collapse
-
#desc ⇒ String
(also: #description)
Description of this note.
-
#initialize(header, stream, offset) ⇒ Note
constructor
Instantiate a Note object.
-
#name ⇒ String
Name of this note.
Constructor Details
#initialize(header, stream, offset) ⇒ Note
Instantiate a ELFTools::Note::Note object.
97 98 99 100 101 |
# File 'lib/elftools/note.rb', line 97 def initialize(header, stream, offset) @header = header @stream = stream @offset = offset end |
Instance Attribute Details
#header ⇒ ELFTools::Structs::ELF_Nhdr (readonly)
Returns Note header.
88 89 90 |
# File 'lib/elftools/note.rb', line 88 def header @header end |
#offset ⇒ Integer (readonly)
Returns Address of this note start, includes note header.
90 91 92 |
# File 'lib/elftools/note.rb', line 90 def offset @offset end |
#stream ⇒ #pos=, #read (readonly)
Returns Streaming object.
89 90 91 |
# File 'lib/elftools/note.rb', line 89 def stream @stream end |
Instance Method Details
#desc ⇒ String Also known as: description
Description of this note.
114 115 116 117 118 119 |
# File 'lib/elftools/note.rb', line 114 def desc return @desc if instance_variable_defined?(:@desc) stream.pos = @offset + SIZE_OF_NHDR + Util.align(header.n_namesz, 2) @desc = stream.read(header.n_descsz) end |
#name ⇒ String
Name of this note.
105 106 107 108 109 110 |
# File 'lib/elftools/note.rb', line 105 def name return @name if defined?(@name) stream.pos = @offset + SIZE_OF_NHDR @name = stream.read(header.n_namesz)[0..-2] end |