Class: HexProgram
- Inherits:
-
Object
- Object
- HexProgram
- Defined in:
- lib/littlewire/gadgets/micronucleus.rb
Instance Method Summary collapse
- #binary ⇒ Object
- #bytes ⇒ Object
-
#initialize(input) ⇒ HexProgram
constructor
A new instance of HexProgram.
Constructor Details
#initialize(input) ⇒ HexProgram
Returns a new instance of HexProgram.
124 125 126 127 128 |
# File 'lib/littlewire/gadgets/micronucleus.rb', line 124 def initialize input @bytes = Hash.new(0xFF) input = input.read if input.is_a? IO parse input end |
Instance Method Details
#binary ⇒ Object
130 131 132 |
# File 'lib/littlewire/gadgets/micronucleus.rb', line 130 def binary bytes.pack('C*') end |
#bytes ⇒ Object
134 135 136 137 138 139 140 |
# File 'lib/littlewire/gadgets/micronucleus.rb', line 134 def bytes highest_address = @bytes.keys.max bytes = Array.new(highest_address + 1) { |index| @bytes[index] } end |