hexdump 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -6
- data/.gitignore +1 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +79 -6
- data/Gemfile +3 -0
- data/LICENSE.txt +1 -1
- data/README.md +500 -137
- data/benchmark.rb +29 -22
- data/gemspec.yml +2 -1
- data/hexdump.gemspec +1 -4
- data/lib/hexdump/chars.rb +46 -0
- data/lib/hexdump/core_ext/file.rb +68 -6
- data/lib/hexdump/core_ext/io.rb +2 -2
- data/lib/hexdump/core_ext/kernel.rb +5 -0
- data/lib/hexdump/core_ext/string.rb +2 -2
- data/lib/hexdump/core_ext/string_io.rb +2 -2
- data/lib/hexdump/core_ext.rb +5 -4
- data/lib/hexdump/format_string.rb +43 -0
- data/lib/hexdump/hexdump.rb +766 -75
- data/lib/hexdump/mixin.rb +192 -0
- data/lib/hexdump/module_methods.rb +132 -0
- data/lib/hexdump/numeric/binary.rb +55 -0
- data/lib/hexdump/numeric/char_or_int.rb +95 -0
- data/lib/hexdump/numeric/decimal.rb +56 -0
- data/lib/hexdump/numeric/exceptions.rb +11 -0
- data/lib/hexdump/numeric/hexadecimal.rb +59 -0
- data/lib/hexdump/numeric/octal.rb +55 -0
- data/lib/hexdump/numeric.rb +5 -0
- data/lib/hexdump/reader.rb +313 -0
- data/lib/hexdump/theme/ansi.rb +82 -0
- data/lib/hexdump/theme/rule.rb +159 -0
- data/lib/hexdump/theme.rb +61 -0
- data/lib/hexdump/type.rb +233 -0
- data/lib/hexdump/types.rb +108 -0
- data/lib/hexdump/version.rb +1 -1
- data/lib/hexdump.rb +14 -3
- data/spec/chars_spec.rb +76 -0
- data/spec/core_ext_spec.rb +10 -6
- data/spec/format_string_spec.rb +22 -0
- data/spec/hexdump_class_spec.rb +1708 -0
- data/spec/hexdump_module_spec.rb +23 -0
- data/spec/mixin_spec.rb +37 -0
- data/spec/numeric/binary_spec.rb +239 -0
- data/spec/numeric/char_or_int_spec.rb +210 -0
- data/spec/numeric/decimal_spec.rb +317 -0
- data/spec/numeric/hexadecimal_spec.rb +320 -0
- data/spec/numeric/octal_spec.rb +239 -0
- data/spec/reader_spec.rb +866 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/theme/ansi_spec.rb +242 -0
- data/spec/theme/rule_spec.rb +199 -0
- data/spec/theme_spec.rb +94 -0
- data/spec/type_spec.rb +317 -0
- data/spec/types_spec.rb +904 -0
- metadata +42 -12
- data/.gemtest +0 -0
- data/lib/hexdump/dumper.rb +0 -419
- data/lib/hexdump/extensions.rb +0 -2
- data/spec/dumper_spec.rb +0 -329
- data/spec/hexdump_spec.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f797d519e67c6284088b0052bc49a75b7fb7b7588d1cdc8b01d017039272c77
|
4
|
+
data.tar.gz: d1920db1ac10b3b2d07bcc3a5423f0764751eb6d2ac64e2e5ddb09ed14cf6e4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e74dcd20c447a3ce959a7af67b65bcaa95a1805c56d9ea205b106d6a04547ff8dd642ae94b5c09213c5356222d7818782805dd38ad7d4b37b6254c9047c218
|
7
|
+
data.tar.gz: b70d82e23d3eeab44dcec8e617198fad89cec5052a37d421d8bdc9ffaf128af6a03a0babca98105c9a8ac1c92406fe956c01426c292be56524a9ad41b79417cd
|
data/.github/workflows/ruby.yml
CHANGED
@@ -9,16 +9,15 @@ jobs:
|
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
11
|
ruby:
|
12
|
-
-
|
13
|
-
-
|
14
|
-
- 2
|
15
|
-
-
|
16
|
-
- 3.0
|
12
|
+
- '3.0'
|
13
|
+
- '3.1'
|
14
|
+
- '3.2'
|
15
|
+
- '3.3'
|
17
16
|
- jruby
|
18
17
|
- truffleruby
|
19
18
|
name: Ruby ${{ matrix.ruby }}
|
20
19
|
steps:
|
21
|
-
- uses: actions/checkout@
|
20
|
+
- uses: actions/checkout@v4
|
22
21
|
- name: Set up Ruby
|
23
22
|
uses: ruby/setup-ruby@v1
|
24
23
|
with:
|
data/.gitignore
CHANGED
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--markup markdown --title "hexdump Documentation" --protected
|
1
|
+
--markup markdown --title "hexdump Documentation" --protected
|
data/ChangeLog.md
CHANGED
@@ -1,11 +1,84 @@
|
|
1
|
+
### 1.0.1 / 2024-01-23
|
2
|
+
|
3
|
+
* Switched to using `require_relative` to improve load-times.
|
4
|
+
* Correctly alias `:long`/`:ulong` to `:int32`/`:uint32`.
|
5
|
+
* Disable ANSI styling in {Hexdump#hexdump} if the output is not a TTY.
|
6
|
+
* Removed the old `hexdump/extensions` file in favor of `hexdump/core_ext`.
|
7
|
+
|
8
|
+
### 1.0.0 / 2021-08-31
|
9
|
+
|
10
|
+
* Added the ability to hexdump typed data. Available `type:`s are :
|
11
|
+
* `:char` - signed 8bit ASCII character
|
12
|
+
* `:uchar` - unsigned 8bit ASCII character
|
13
|
+
* `:int8` - signed 8bit integer
|
14
|
+
* `:uin8` / `:byte` - unsigned 8bit integer (default)
|
15
|
+
* `:int16` / `:short` - signed 16bit integer
|
16
|
+
* `:int16_le` / `:short_le` - signed 16bit integer (little endian)
|
17
|
+
* `:int16_be` / `:short_be` - signed 16bit integer (big endian)
|
18
|
+
* `:int16_ne` / `:short_ne` - signed 16bit integer (network endian)
|
19
|
+
* `:uint16` / `:ushort` - unsigned 16bit integer
|
20
|
+
* `:uint16_le` / `:ushort_le` - unsigned 16bit integer (little endian)
|
21
|
+
* `:uint16_be` / `:ushort_be` - unsigned 16bit integer (big endian)
|
22
|
+
* `:uint16_ne` / `:ushort_ne` - unsigned 16bit integer (network endian)
|
23
|
+
* `:int32` / `:int` / `:long` - signed 32bit integer
|
24
|
+
* `:int32_le` / `:int_le` / `:long_le` - signed 32bit integer (little endian)
|
25
|
+
* `:int32_be` / `:int_be` / `:long_be` - signed 32bit integer (big endian)
|
26
|
+
* `:int32_ne` / `:int_ne` / `:long_ne` - signed 32bit integer (network endian)
|
27
|
+
* `:uint32` / `:uint` / `:ulong` - unsigned 32bit integer
|
28
|
+
* `:uint32_le` / `:uint_le` / `:ulong_le` - unsigned 32bit integer (little endian)
|
29
|
+
* `:uint32_be` / `:uint_be` / `:ulong_be` - unsigned 32bit integer (big endian)
|
30
|
+
* `:uint32_ne` / `:uint_ne` / `:ulong_ne` - unsigned 32bit integer (network endian)
|
31
|
+
* `:int64` / `:long_long` - signed 64bit integer
|
32
|
+
* `:int64_le` / `:long_long_le` - signed 64bit integer (little endian)
|
33
|
+
* `:int64_be` / `:long_long_be` - signed 64bit integer (big endian)
|
34
|
+
* `:int64_ne` / `:long_long_ne` - signed 64bit integer (network endian)
|
35
|
+
* `:uint64` / `:ulong_long` - unsigned 64bit integer
|
36
|
+
* `:uint64_le` / `:ulong_long_le` - unsigned 64bit integer (little endian)
|
37
|
+
* `:uint64_be` / `:ulong_long_be` - unsigned 64bit integer (big endian)
|
38
|
+
* `:uint64_ne` / `ulong_long_ne` - unsigned 64bit integer (network endian)
|
39
|
+
* `:float` - single precision 32bit floating-point number
|
40
|
+
* `:float_le` - single precision 32bit floating-point number (little endian)
|
41
|
+
* `:float_be` - single precision 32bit floating-point number (big endian)
|
42
|
+
* `:float_ne` - single precision 32bit floating-point number (network endian)
|
43
|
+
* `:double` - double precision 64bit floating-point number
|
44
|
+
* `:double_le` - double precision 64bit floating-point number (little endian)
|
45
|
+
* `:double_be` - double precision 64bit floating-point number (big endian)
|
46
|
+
* `:double_ne` - double precision 64bit floating-point number (network endian)
|
47
|
+
* Added support for optionally skipping N bytes or reading at most N bytes of
|
48
|
+
data (ex: `offset: 10` and `length: 100`).
|
49
|
+
* Added support for optional zero-padding of the data so it aligns with the type
|
50
|
+
size (ex: `zero_pad: true`).
|
51
|
+
* Added support for displaying the index in a separate numeric base than the
|
52
|
+
numeric columns (ex: `index_base: 10, base: 2`). Defaults to base 16.
|
53
|
+
* Added support for omitting repeating rows with a `*` (ex: `repeating: true` or
|
54
|
+
`repeating: false` to disable).
|
55
|
+
* Added support for grouping columns together like GNU `hexdump -C` (ex:
|
56
|
+
`group_columns: 4`).
|
57
|
+
* Added support for grouping characters together (ex: `group_chars: 4`).
|
58
|
+
* Added support for grouping characters together to align with the type's size
|
59
|
+
(ex: `group_chars: :type`).
|
60
|
+
* Added support for displaying UTF-8 characters or other character encodings.
|
61
|
+
* Added support for disabling the characters column entirely
|
62
|
+
(ex: `chars_column: false`).
|
63
|
+
* Added support for ANSI styling and highlighting (ex: `style: {...}` and
|
64
|
+
`highlights: {...}`).
|
65
|
+
* Added {Hexdump::ModuleMethods} to provide a top-level
|
66
|
+
{Hexdump::ModuleMethods#hexdump hexdump} method.
|
67
|
+
* Include {Hexdump::ModuleMethods} into {Kernel} by default.
|
68
|
+
* Added preliminary truffleruby support.
|
69
|
+
* Only issue was https://github.com/oracle/truffleruby/issues/2426
|
70
|
+
* `hexdump` methods now accept a block for configuring the hexdump instance.
|
71
|
+
* Renamed `Hexdump::Dumper` to {Hexdump::Hexdump}.
|
72
|
+
* Renamed the `:width` option to `:columns`.
|
73
|
+
|
1
74
|
### 0.3.0 / 2021-04-10
|
2
75
|
|
3
76
|
* Require Ruby >= 2.0.0.
|
4
77
|
* Added support for Ruby 3.0.
|
5
|
-
* {Hexdump.dump}, {Hexdump#dump}, and
|
78
|
+
* {Hexdump.dump}, {Hexdump#dump}, and `Hexdump::Dumper#initialize` now accept
|
6
79
|
keyword arguments.
|
7
|
-
*
|
8
|
-
*
|
80
|
+
* `Hexdump::Dumper#each` now returns the total number of bytes read.
|
81
|
+
* `Hexdump::Dumper#dump` now prints the final number of bytes read on the last
|
9
82
|
line.
|
10
83
|
* Micro-optimizations to improve performance on JRuby and TruffleRuby.
|
11
84
|
|
@@ -22,7 +95,7 @@
|
|
22
95
|
### 0.2.2 / 2012-05-27
|
23
96
|
|
24
97
|
* Added {Hexdump::VERSION}.
|
25
|
-
* Rescue `RangeError`s in
|
98
|
+
* Rescue `RangeError`s in `Hexdump::Dumper#format_printable`.
|
26
99
|
* Fixed a typo in `benchmarks/hexdump.rb` (thanks ColMcp).
|
27
100
|
* Fixed a typo in Source URL, in the README (thanks Lawrence Woodman).
|
28
101
|
* Documented the `:endian` option for {Hexdump.dump}.
|
@@ -31,12 +104,12 @@
|
|
31
104
|
|
32
105
|
### 0.2.1 / 2011-06-11
|
33
106
|
|
34
|
-
* Fixed a major bug in
|
107
|
+
* Fixed a major bug in `Hexdump::Dumper#dump`, where the line buffers
|
35
108
|
were not being cleared.
|
36
109
|
|
37
110
|
### 0.2.0 / 2011-06-11
|
38
111
|
|
39
|
-
* Added
|
112
|
+
* Added `Hexdump::Dumper`.
|
40
113
|
* Added support for hexdumping 1, 2, 4, 8 byte words.
|
41
114
|
* Added support for hexdumping Little and Big Endian words.
|
42
115
|
* Optimized the hexdump algorithm to not use Arrays, use a lookup table
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED