Module: Hexdump::Mixin
Overview
Provides a Mixin#hexdump method that can be included into objects.
class DataObject
include Hexdump::Mixin
def each_byte
# ...
end
end
data.hexdump
Instance Method Summary collapse
-
#hexdump(output: $stdout, **kwargs) {|hexdump| ... } ⇒ Object
Prints a hexdumps of the object.
-
#to_hexdump(**kwargs) {|hexdump| ... } ⇒ String
Outputs the hexdump to a String.
Instance Method Details
#hexdump(output: $stdout, **kwargs) {|hexdump| ... } ⇒ Object
Prints a hexdumps of the object.
105 106 107 108 109 |
# File 'lib/hexdump/mixin.rb', line 105 def hexdump(output: $stdout, **kwargs,&block) hexdump = ::Hexdump::Hexdump.new(**kwargs,&block) hexdump.hexdump(self, output: output) end |
#to_hexdump(**kwargs) {|hexdump| ... } ⇒ String
Note:
Caution: this method appends each line of the hexdump to a String, and that String can grow quite large and consume a lot of memory.
Outputs the hexdump to a String.
186 187 188 189 190 |
# File 'lib/hexdump/mixin.rb', line 186 def to_hexdump(**kwargs,&block) hexdump = ::Hexdump::Hexdump.new(**kwargs,&block) hexdump.dump(self) end |