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.
100 101 102 103 104 |
# File 'lib/elftools/note.rb', line 100 def initialize(header, stream, offset) @header = header @stream = stream @offset = offset end |
Instance Attribute Details
#header ⇒ ELFTools::Structs::ELF_Nhdr (readonly)
Returns Note header.
91 92 93 |
# File 'lib/elftools/note.rb', line 91 def header @header end |
#offset ⇒ Integer (readonly)
Returns Address of this note start, includes note header.
93 94 95 |
# File 'lib/elftools/note.rb', line 93 def offset @offset end |
#stream ⇒ #pos=, #read (readonly)
Returns Streaming object.
92 93 94 |
# File 'lib/elftools/note.rb', line 92 def stream @stream end |
Instance Method Details
#desc ⇒ String Also known as: description
Description of this note.
117 118 119 120 121 122 |
# File 'lib/elftools/note.rb', line 117 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.
108 109 110 111 112 113 |
# File 'lib/elftools/note.rb', line 108 def name return @name if defined?(@name) stream.pos = @offset + SIZE_OF_NHDR @name = stream.read(header.n_namesz)[0..-2] end |