hexdump 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c7d2cd541f81ae5ed4191d544eac913e7e9b2f55fad23320fedb00ce6b02eb2
4
- data.tar.gz: 6c12dd82076f8b2bf1272ad47f9e509c6f0553642c9ad2079eeab38bca3dad36
3
+ metadata.gz: 7f797d519e67c6284088b0052bc49a75b7fb7b7588d1cdc8b01d017039272c77
4
+ data.tar.gz: d1920db1ac10b3b2d07bcc3a5423f0764751eb6d2ac64e2e5ddb09ed14cf6e4d
5
5
  SHA512:
6
- metadata.gz: cf2a9fc5999b94a8ad91b5bcef2a001a66e1e2f9e177b37c7e256df6775b708d84e061b0024428f3c6a0834d42f148d714f0e200a923b64f979761d500f60088
7
- data.tar.gz: 7044bdfd16ff11ac1cb38b9d1f9d28faf61d147d1f5f2932e37e018479de77c194e587e39342a45103c6c4acc2128f09463d1b56f44637f99e850103c07a7c87
6
+ metadata.gz: a2e74dcd20c447a3ce959a7af67b65bcaa95a1805c56d9ea205b106d6a04547ff8dd642ae94b5c09213c5356222d7818782805dd38ad7d4b37b6254c9047c218
7
+ data.tar.gz: b70d82e23d3eeab44dcec8e617198fad89cec5052a37d421d8bdc9ffaf128af6a03a0babca98105c9a8ac1c92406fe956c01426c292be56524a9ad41b79417cd
@@ -9,16 +9,15 @@ jobs:
9
9
  fail-fast: false
10
10
  matrix:
11
11
  ruby:
12
- - 2.4
13
- - 2.5
14
- - 2.6
15
- - 2.7
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@v2
20
+ - uses: actions/checkout@v4
22
21
  - name: Set up Ruby
23
22
  uses: ruby/setup-ruby@v1
24
23
  with:
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /Gemfile.lock
2
+ /coverage
2
3
  /doc/
3
4
  /pkg/
4
5
  /vendor/bundle/
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup markdown --title "hexdump Documentation" --protected --quiet
1
+ --markup markdown --title "hexdump Documentation" --protected
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ### 1.0.0 / 2021-08-31
2
9
 
3
10
  * Added the ability to hexdump typed data. Available `type:`s are :
@@ -68,10 +75,10 @@
68
75
 
69
76
  * Require Ruby >= 2.0.0.
70
77
  * Added support for Ruby 3.0.
71
- * {Hexdump.dump}, {Hexdump#dump}, and {Hexdump::Dumper#initialize} now accept
78
+ * {Hexdump.dump}, {Hexdump#dump}, and `Hexdump::Dumper#initialize` now accept
72
79
  keyword arguments.
73
- * {Hexdump::Dumper#each} now returns the total number of bytes read.
74
- * {Hexdump::Dumper#dump} now prints the final number of bytes read on the last
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
75
82
  line.
76
83
  * Micro-optimizations to improve performance on JRuby and TruffleRuby.
77
84
 
@@ -102,7 +109,7 @@
102
109
 
103
110
  ### 0.2.0 / 2011-06-11
104
111
 
105
- * Added {Hexdump::Dumper}.
112
+ * Added `Hexdump::Dumper`.
106
113
  * Added support for hexdumping 1, 2, 4, 8 byte words.
107
114
  * Added support for hexdumping Little and Big Endian words.
108
115
  * Optimized the hexdump algorithm to not use Arrays, use a lookup table
data/Gemfile CHANGED
@@ -6,7 +6,9 @@ group :development do
6
6
  gem 'rake'
7
7
  gem 'rubygems-tasks', '~> 0.2'
8
8
  gem 'rspec', '~> 3.0'
9
+ gem 'simplecov', '~> 0.20'
9
10
  gem 'kramdown'
11
+ gem 'redcarpet', platform: :mri
10
12
  gem 'yard', '~> 0.9'
11
13
  gem 'yard-spellcheck', require: false
12
14
  end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2021 Hal Brodigan
1
+ Copyright (c) 2011-2024 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # hexdump.rb
2
2
 
3
3
  [![CI](https://github.com/postmodern/hexdump.rb/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/hexdump.rb/actions/workflows/ruby.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/hexdump.svg)](https://badge.fury.io/rb/hexdump)
4
5
 
5
6
  * [Source](https://github.com/postmodern/hexdump.rb)
6
7
  * [Issues](https://github.com/postmodern/hexdump.rb/issues)
7
- * [Documentation](http://rubydoc.info/gems/hexdump/frames)
8
+ * [Documentation](https://rubydoc.info/gems/hexdump)
8
9
 
9
10
  ## Description
10
11
 
11
- Simple and Fast hexdumping for Ruby.
12
+ Fully Featured and Fast hexdumping for Ruby.
12
13
 
13
14
  ## Features
14
15
 
@@ -27,24 +28,29 @@ Simple and Fast hexdumping for Ruby.
27
28
  * `uint16_le` / `ushort_le` - unsigned 16bit integer (little endian)
28
29
  * `uint16_be` / `ushort_be` - unsigned 16bit integer (big endian)
29
30
  * `uint16_ne` / `ushort_ne` - unsigned 16bit integer (network endian)
30
- * `int32` / `int` / `long` - signed 32bit integer
31
- * `int32_le` / `int_le` / `long_le` - signed 32bit integer (little endian)
32
- * `int32_be` / `int_be` / `long_be` - signed 32bit integer (big endian)
33
- * `int32_ne` / `int_ne` / `long_ne` - signed 32bit integer (network endian)
34
- * `uint32` / `uint` / `ulong` - unsigned 32bit integer
35
- * `uint32_le` / `uint_le` / `ulong_le` - unsigned 32bit integer
31
+ * `int32` / `int` - signed 32bit integer
32
+ * `int32_le` / `int_le` - signed 32bit integer (little endian)
33
+ * `int32_be` / `int_be` - signed 32bit integer (big endian)
34
+ * `int32_ne` / `int_ne` - signed 32bit integer (network endian)
35
+ * `uint32` / `uint` / - unsigned 32bit integer
36
+ * `uint32_le` / `uint_le` - unsigned 32bit integer
36
37
  (little endian)
37
- * `uint32_be` / `uint_be` / `ulong_be` - unsigned 32bit integer (big endian)
38
- * `uint32_ne` / `uint_ne` / `ulong_ne` - unsigned 32bit integer
38
+ * `uint32_be` / `uint_be` - unsigned 32bit integer (big endian)
39
+ * `uint32_ne` / `uint_ne` - unsigned 32bit integer
40
+ (network endian)
41
+ * `int64` / `long` / `long_long` - signed 64bit integer
42
+ * `int64_le` / `long_le` / `long_long_le` - signed 64bit integer
43
+ (little endian)
44
+ * `int64_be` / `long_be` / `long_long_be` - signed 64bit integer (big endian)
45
+ * `int64_ne` / `long_ne` / `long_long_ne` - signed 64bit integer
46
+ (network endian)
47
+ * `uint64` `ulong` / `ulong_long` - unsigned 64bit integer
48
+ * `uint64_le` / `ulong_le` / `ulong_long_le` - unsigned 64bit integer
49
+ (little endian)
50
+ * `uint64_be` / `ulong_be` / `ulong_long_be` - unsigned 64bit integer
51
+ (big endian)
52
+ * `uint64_ne` / `ulong_ne` / `ulong_long_ne` - unsigned 64bit integer
39
53
  (network endian)
40
- * `int64` / `long_long` - signed 64bit integer
41
- * `int64_le` / `long_long_le` - signed 64bit integer (little endian)
42
- * `int64_be` / `long_long_be` - signed 64bit integer (big endian)
43
- * `int64_ne` / `long_long_ne` - signed 64bit integer (network endian)
44
- * `uint64` / `ulong_long` - unsigned 64bit integer
45
- * `uint64_le` / `ulong_long_le` - unsigned 64bit integer (little endian)
46
- * `uint64_be` / `ulong_long_be` - unsigned 64bit integer (big endian)
47
- * `uint64_ne` / `ulong_long_ne` - unsigned 64bit integer (network endian)
48
54
  * `float` - single precision 32bit floating-point number
49
55
  * `float_le` - single precision 32bit floating-point number (little endian)
50
56
  * `float_be` - single precision 32bit floating-point number (big endian)
@@ -66,6 +72,12 @@ Simple and Fast hexdumping for Ruby.
66
72
  * Makes {String}, {StringIO}, {IO}, {File} objects hexdumpable.
67
73
  * Fast-ish.
68
74
 
75
+ ## Requirements
76
+
77
+ * [Ruby] >= 2.0.0
78
+
79
+ [Ruby]: https://www.ruby-lang.org/
80
+
69
81
  ## Install
70
82
 
71
83
  ```shell
@@ -241,7 +253,7 @@ Hexdump.hexdump("ABCD" * 7, type: :uint32_be)
241
253
  ### Int Type
242
254
 
243
255
  ```ruby
244
- Hexdump.hexdump([65535, -1].pack("LL"), type: :int32_be, base: 10)
256
+ Hexdump.hexdump([65535, -1].pack("LL"), type: :int32, base: 10)
245
257
  # 00000000 65535 -1 |........|
246
258
  # 00000008
247
259
  ```
data/gemspec.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  name: hexdump
2
2
  summary: Hexdump Strings and IO objects.
3
- description: Simple and Fast hexdumping for Ruby.
3
+ description: Fully Featured and Fast hexdumping for Ruby.
4
4
  license: MIT
5
5
  authors: Postmodern
6
6
  email: postmodern.mod3@gmail.com
@@ -12,6 +12,7 @@ metadata:
12
12
  source_code_uri: https://github.com/postmodern/hexdump.rb
13
13
  bug_tracker_uri: https://github.com/postmodern/hexdump.rb/issues
14
14
  changelog_uri: https://github.com/postmodern/hexdump.rb/blob/master/ChangeLog.md
15
+ rubygems_mfa_required: 'true'
15
16
 
16
17
  required_ruby_version: ">= 2.0.0"
17
18
 
data/hexdump.gemspec CHANGED
@@ -7,10 +7,7 @@ Gem::Specification.new do |gem|
7
7
 
8
8
  gem.name = gemspec.fetch('name')
9
9
  gem.version = gemspec.fetch('version') do
10
- lib_dir = File.join(File.dirname(__FILE__),'lib')
11
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
-
13
- require 'hexdump/version'
10
+ require_relative 'lib/hexdump/version'
14
11
  Hexdump::VERSION
15
12
  end
16
13
 
@@ -1,4 +1,4 @@
1
- require 'hexdump/core_ext/io'
1
+ require_relative 'io'
2
2
 
3
3
  class File
4
4
 
@@ -9,7 +9,7 @@ class File
9
9
  # The path of the file.
10
10
  #
11
11
  # @param [Hash{Symbol => Object}] kwargs
12
- # Additional keyword arguments for {Format#initialize}.
12
+ # Additional keyword arguments for {Hexdump::Hexdump#initialize}.
13
13
  #
14
14
  # @option kwargs [#print] :output ($stdout)
15
15
  # The output to print the hexdump to.
@@ -1,4 +1,4 @@
1
- require 'hexdump/mixin'
1
+ require_relative '../mixin'
2
2
 
3
3
  class IO
4
4
 
@@ -1,7 +1,5 @@
1
- require 'hexdump/module_methods'
2
-
3
- module ::Kernel
4
- private
1
+ require_relative '../module_methods'
5
2
 
3
+ module Kernel
6
4
  include Hexdump::ModuleMethods
7
5
  end
@@ -1,4 +1,4 @@
1
- require 'hexdump/mixin'
1
+ require_relative '../mixin'
2
2
 
3
3
  class String
4
4
 
@@ -1,4 +1,4 @@
1
- require 'hexdump/mixin'
1
+ require_relative '../mixin'
2
2
 
3
3
  require 'stringio'
4
4
 
@@ -1,5 +1,5 @@
1
- require 'hexdump/core_ext/string'
2
- require 'hexdump/core_ext/string_io'
3
- require 'hexdump/core_ext/io'
4
- require 'hexdump/core_ext/file'
5
- require 'hexdump/core_ext/kernel'
1
+ require_relative 'core_ext/string'
2
+ require_relative 'core_ext/string_io'
3
+ require_relative 'core_ext/io'
4
+ require_relative 'core_ext/file'
5
+ require_relative 'core_ext/kernel'
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'hexdump/types'
4
- require 'hexdump/reader'
5
- require 'hexdump/numeric'
6
- require 'hexdump/chars'
7
- require 'hexdump/theme'
3
+ require_relative 'types'
4
+ require_relative 'reader'
5
+ require_relative 'numeric'
6
+ require_relative 'chars'
7
+ require_relative 'theme'
8
8
 
9
9
  module Hexdump
10
10
  #
@@ -93,7 +93,7 @@ module Hexdump
93
93
  # @param [Integer] index_offset
94
94
  # The offset to start the index at.
95
95
  #
96
- # @param [Boolean] chars
96
+ # @param [Boolean] chars_column
97
97
  # Controls whether to display the characters column.
98
98
  #
99
99
  # @param [:ascii, :utf8, Encoding, nil] encoding
@@ -481,16 +481,14 @@ module Hexdump
481
481
  # The given block will be passed the hexdump break-down of each
482
482
  # row.
483
483
  #
484
- # @yieldparam [Integer, '*'] index
484
+ # @yieldparam [Integer] index
485
485
  # The index of the hexdumped row.
486
- # If the index is `'*'`, then it indicates the beginning of repeating
487
- # rows of data.
488
486
  #
489
487
  # @yieldparam [Array<Integer>, Array<Float>] values
490
488
  # The decoded values.
491
489
  #
492
- # @yieldparam [String] chars
493
- # A raw characters that were read.
490
+ # @yieldparam [Array<String>, nil] chars
491
+ # The underlying raw characters that were read.
494
492
  #
495
493
  # @return [Integer, Enumerator]
496
494
  # If a block is given, then the final number of bytes read is returned.
@@ -584,7 +582,7 @@ module Hexdump
584
582
  # The given block will be passed the hexdump break-down of each
585
583
  # row.
586
584
  #
587
- # @yieldparam [Integer, '*'] index
585
+ # @yieldparam [String] index
588
586
  # The index of the hexdumped row.
589
587
  # If the index is `'*'`, then it indicates the beginning of repeating
590
588
  # rows of data.
@@ -592,7 +590,7 @@ module Hexdump
592
590
  # @yieldparam [Array<String>, nil] numeric
593
591
  # The numeric representation of the row.
594
592
  #
595
- # @yieldparam [Array<String>, nil] chars
593
+ # @yieldparam [String, nil] chars
596
594
  # The printable representation of the row.
597
595
  #
598
596
  # @return [String, Enumerator]
@@ -736,7 +734,7 @@ module Hexdump
736
734
  # @param [#each_byte] data
737
735
  # The data to be hexdumped.
738
736
  #
739
- # @param [#print] output
737
+ # @param [#<<] output
740
738
  # The output to dump the hexdump to.
741
739
  #
742
740
  # @return [nil]
@@ -749,7 +747,7 @@ module Hexdump
749
747
  raise(ArgumentError,"output must support the #<< method")
750
748
  end
751
749
 
752
- ansi = theme? && $stdout.tty?
750
+ ansi = theme? && output.tty?
753
751
 
754
752
  each_line(data, ansi: ansi) do |line|
755
753
  output << line
data/lib/hexdump/mixin.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'hexdump/hexdump'
1
+ require_relative 'hexdump'
2
2
 
3
3
  module Hexdump
4
4
  #
@@ -27,9 +27,6 @@ module Hexdump
27
27
  # @param [#print] output ($stdout)
28
28
  # The output to print the hexdump to.
29
29
  #
30
- # @param [Integer] offset
31
- # The offset to start the index at.
32
- #
33
30
  # @param [Hash{Symbol => Object}] kwargs
34
31
  # Additional keyword arguments for {Hexdump#initialize}.
35
32
  #
@@ -114,9 +111,6 @@ module Hexdump
114
111
  #
115
112
  # Outputs the hexdump to a String.
116
113
  #
117
- # @param [Integer] offset
118
- # The offset to start the index at.
119
- #
120
114
  # @param [Hash{Symbol => Object}] kwargs
121
115
  # Additional keyword arguments for {Hexdump#initialize}.
122
116
  #
@@ -1,4 +1,4 @@
1
- require 'hexdump/hexdump'
1
+ require_relative 'hexdump'
2
2
 
3
3
  module Hexdump
4
4
  #
@@ -1,5 +1,5 @@
1
- require 'hexdump/numeric/exceptions'
2
- require 'hexdump/format_string'
1
+ require_relative 'exceptions'
2
+ require_relative '../format_string'
3
3
 
4
4
  module Hexdump
5
5
  module Numeric
@@ -1,4 +1,4 @@
1
- require 'hexdump/format_string'
1
+ require_relative '../format_string'
2
2
 
3
3
  module Hexdump
4
4
  module Numeric
@@ -9,7 +9,7 @@ module Hexdump
9
9
  #
10
10
  class CharOrInt < FormatString
11
11
 
12
- # @return [Base::Hexadecimal, Base::Decimal, Base::Octal, Base::Binary]
12
+ # @return [Hexadecimal, Decimal, Octal, Binary]
13
13
  attr_reader :base
14
14
 
15
15
  # @return [Encoding, nil]
@@ -18,7 +18,7 @@ module Hexdump
18
18
  #
19
19
  # Initializes the character format.
20
20
  #
21
- # @param [Base::Hexadecimal, Base::Decimal, Base::Octal, Base::Binary] base
21
+ # @param [Hexadecimal, Decimal, Octal, Binary] base
22
22
  # The numeric base format to fallback to if a value does not map to a
23
23
  # character.
24
24
  #
@@ -32,6 +32,11 @@ module Hexdump
32
32
  super("%#{@base.width}s")
33
33
  end
34
34
 
35
+ #
36
+ # The string width associated with the numeric base.
37
+ #
38
+ # @return [Integer]
39
+ #
35
40
  def width
36
41
  @base.width
37
42
  end
@@ -1,4 +1,4 @@
1
- require 'hexdump/format_string'
1
+ require_relative '../format_string'
2
2
 
3
3
  module Hexdump
4
4
  module Numeric
@@ -1,4 +1,4 @@
1
- require 'hexdump/format_string'
1
+ require_relative '../format_string'
2
2
 
3
3
  module Hexdump
4
4
  module Numeric
@@ -1,5 +1,5 @@
1
- require 'hexdump/numeric/exceptions'
2
- require 'hexdump/format_string'
1
+ require_relative 'exceptions'
2
+ require_relative '../format_string'
3
3
 
4
4
  module Hexdump
5
5
  module Numeric
@@ -1,5 +1,5 @@
1
- require 'hexdump/numeric/binary'
2
- require 'hexdump/numeric/octal'
3
- require 'hexdump/numeric/decimal'
4
- require 'hexdump/numeric/hexadecimal'
5
- require 'hexdump/numeric/char_or_int'
1
+ require_relative 'numeric/binary'
2
+ require_relative 'numeric/octal'
3
+ require_relative 'numeric/decimal'
4
+ require_relative 'numeric/hexadecimal'
5
+ require_relative 'numeric/char_or_int'
@@ -32,7 +32,8 @@ module Hexdump
32
32
  # The type to decode the data as.
33
33
  #
34
34
  # @param [Integer, nil] offset
35
- # Controls whether to offset N number of bytes before starting to read data.
35
+ # Controls whether to offset N number of bytes before starting to read
36
+ # data.
36
37
  #
37
38
  # @param [Integer, nil] length
38
39
  # Controls control many bytes to read.
@@ -103,8 +104,6 @@ module Hexdump
103
104
  raise(ArgumentError,"the given data must respond to #each_byte")
104
105
  end
105
106
 
106
- count = 0
107
-
108
107
  if @type.size == 1
109
108
  each_byte(data) do |b|
110
109
  yield b.chr
@@ -133,7 +132,7 @@ module Hexdump
133
132
 
134
133
  yield buffer
135
134
  else
136
- # yield the reamining partial buffer
135
+ # yield the remaining partial buffer
137
136
  yield buffer[0,index]
138
137
  end
139
138
  end
@@ -173,24 +172,24 @@ module Hexdump
173
172
  when :little then 'S<'
174
173
  when :big then 'S>'
175
174
  else
176
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
175
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
177
176
  end
178
177
  when 4
179
178
  case @type.endian
180
179
  when :little then 'L<'
181
180
  when :big then 'L>'
182
181
  else
183
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
182
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
184
183
  end
185
184
  when 8
186
185
  case @type.endian
187
186
  when :little then 'Q<'
188
187
  when :big then 'Q>'
189
188
  else
190
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
189
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
191
190
  end
192
191
  else
193
- raise(TypeError,"unsupported type size #{@type.size} for #{@type.name}")
192
+ raise(TypeError,"unsupported type size #{@type.size} for #{@type.inspect}")
194
193
  end
195
194
 
196
195
  each_slice(data) do |slice|
@@ -221,24 +220,24 @@ module Hexdump
221
220
  when :little then 's<'
222
221
  when :big then 's>'
223
222
  else
224
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
223
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
225
224
  end
226
225
  when 4
227
226
  case @type.endian
228
227
  when :little then 'l<'
229
228
  when :big then 'l>'
230
229
  else
231
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
230
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
232
231
  end
233
232
  when 8
234
233
  case @type.endian
235
234
  when :little then 'q<'
236
235
  when :big then 'q>'
237
236
  else
238
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
237
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
239
238
  end
240
239
  else
241
- raise(TypeError,"unsupported type size #{@type.size} for #{@type.name}")
240
+ raise(TypeError,"unsupported type size #{@type.size} for #{@type.inspect}")
242
241
  end
243
242
 
244
243
  each_slice(data) do |slice|
@@ -266,17 +265,17 @@ module Hexdump
266
265
  when 4 then 'e'
267
266
  when 8 then 'E'
268
267
  else
269
- raise(TypeError,"unsupported type size #{@type.size} for #{@type.name}")
268
+ raise(TypeError,"unsupported type size #{@type.size} for #{@type.inspect}")
270
269
  end
271
270
  when :big
272
271
  case @type.size
273
272
  when 4 then 'g'
274
273
  when 8 then 'G'
275
274
  else
276
- raise(TypeError,"unsupported type size #{@type.size} for #{@type.name}")
275
+ raise(TypeError,"unsupported type size #{@type.size} for #{@type.inspect}")
277
276
  end
278
277
  else
279
- raise(TypeError,"unsupported endian #{@type.endian} for #{@type.name}")
278
+ raise(TypeError,"unsupported endian #{@type.endian} for #{@type.inspect}")
280
279
  end
281
280
 
282
281
  each_slice(data) do |slice|
@@ -52,7 +52,8 @@ module Hexdump
52
52
  #
53
53
  # Initializes an ANSI control sequence.
54
54
  #
55
- # @param [Symbol, Array<Symbol>] style
55
+ # @param [Symbol, Array<Symbol>] parameters
56
+ # The ANSI styling parameters. See {PARAMETERS}.
56
57
  #
57
58
  def initialize(parameters)
58
59
  @parameters = parameters
@@ -1,4 +1,4 @@
1
- require 'hexdump/theme/ansi'
1
+ require_relative 'ansi'
2
2
 
3
3
  require 'strscan'
4
4
 
data/lib/hexdump/theme.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'hexdump/theme/rule'
1
+ require_relative 'theme/rule'
2
2
 
3
3
  module Hexdump
4
4
  #
data/lib/hexdump/type.rb CHANGED
@@ -19,13 +19,14 @@ module Hexdump
19
19
  #
20
20
  # Initializes the type.
21
21
  #
22
- # @param [Symbol] name
22
+ # @param [1, 2, 4, 8] size
23
+ # The type's size in bytes.
23
24
  #
24
25
  # @param [:little, :big, nil] endian
25
- #
26
- # @param [1, 2, 4, 8] size
26
+ # The endianness of the type. `nil` indicates the type has no endianness.
27
27
  #
28
28
  # @param [Boolean] signed
29
+ # Indicates whether the type is signed or unsigned.
29
30
  #
30
31
  # @raise [ArgumentError]
31
32
  # Invalid `endian:` or `size:` values.
data/lib/hexdump/types.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'hexdump/type'
1
+ require_relative 'type'
2
2
 
3
3
  module Hexdump
4
4
  #
@@ -76,15 +76,15 @@ module Hexdump
76
76
  TYPES[:uint_be] = TYPES[:uint32_be]
77
77
  TYPES[:uint_ne] = TYPES[:uint32_ne]
78
78
 
79
- TYPES[:long] = TYPES[:int32]
80
- TYPES[:long_le] = TYPES[:int32_le]
81
- TYPES[:long_be] = TYPES[:int32_be]
82
- TYPES[:long_ne] = TYPES[:int32_ne]
79
+ TYPES[:long] = TYPES[:int64]
80
+ TYPES[:long_le] = TYPES[:int64_le]
81
+ TYPES[:long_be] = TYPES[:int64_be]
82
+ TYPES[:long_ne] = TYPES[:int64_ne]
83
83
 
84
- TYPES[:ulong] = TYPES[:uint32]
85
- TYPES[:ulong_le] = TYPES[:uint32_le]
86
- TYPES[:ulong_be] = TYPES[:uint32_be]
87
- TYPES[:ulong_ne] = TYPES[:uint32_ne]
84
+ TYPES[:ulong] = TYPES[:uint64]
85
+ TYPES[:ulong_le] = TYPES[:uint64_le]
86
+ TYPES[:ulong_be] = TYPES[:uint64_be]
87
+ TYPES[:ulong_ne] = TYPES[:uint64_ne]
88
88
 
89
89
  TYPES[:long_long] = TYPES[:int64]
90
90
  TYPES[:long_long_le] = TYPES[:int64_le]
@@ -1,4 +1,4 @@
1
1
  module Hexdump
2
2
  # hexdump version
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
data/lib/hexdump.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'hexdump/module_methods'
2
- require 'hexdump/core_ext'
3
- require 'hexdump/version'
1
+ require_relative 'hexdump/module_methods'
2
+ require_relative 'hexdump/core_ext'
3
+ require_relative 'hexdump/version'
4
4
 
5
5
  module Hexdump
6
6
  extend ModuleMethods
@@ -19,6 +19,6 @@ describe "Hexdump core_ext" do
19
19
  end
20
20
 
21
21
  it "should include Hexdump::ModuleMethods into ::Kernel" do
22
- expect(::Kernel).to include(Hexdump::ModuleMethods)
22
+ expect(Kernel).to include(Hexdump::ModuleMethods)
23
23
  end
24
24
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+ require 'hexdump/format_string'
3
+
4
+ describe Hexdump::FormatString do
5
+ let(:fmt) { "%x" }
6
+
7
+ subject { described_class.new(fmt) }
8
+
9
+ describe "#%" do
10
+ let(:value) { 255 }
11
+
12
+ it "must format the given value" do
13
+ expect(subject % value).to eq(fmt % value)
14
+ end
15
+ end
16
+
17
+ describe "#to_s" do
18
+ it "must return the format string" do
19
+ expect(subject.to_s).to eq(fmt)
20
+ end
21
+ end
22
+ end
data/spec/reader_spec.rb CHANGED
@@ -53,11 +53,13 @@ describe Hexdump::Reader do
53
53
  end
54
54
  end
55
55
 
56
+ let(:type) { Hexdump::TYPES[:byte] }
57
+
58
+ subject { described_class.new(type) }
59
+
56
60
  describe "#each_byte" do
57
61
  let(:type) { Hexdump::TYPES[:uint8] }
58
62
 
59
- subject { described_class.new(type) }
60
-
61
63
  let(:chars) { %w[A B C D] }
62
64
  let(:data) { chars.join }
63
65
  let(:bytes) { data.bytes }
@@ -107,8 +109,6 @@ describe Hexdump::Reader do
107
109
  let(:chars) { %w[A B C D] }
108
110
  let(:data) { "ABCD" }
109
111
 
110
- subject { described_class.new(type) }
111
-
112
112
  it "must yield each consequetize character" do
113
113
  expect { |b|
114
114
  subject.each_slice(data,&b)
@@ -147,8 +147,6 @@ describe Hexdump::Reader do
147
147
  let(:slices) { %w[AA BB CC DD EE FF] }
148
148
  let(:data) { "AABBCCDDEEFF" }
149
149
 
150
- subject { described_class.new(type) }
151
-
152
150
  it "must yield each slice of the String" do
153
151
  expect { |b|
154
152
  subject.each_slice(data,&b)
@@ -220,9 +218,7 @@ describe Hexdump::Reader do
220
218
  let(:bytes) { [0x41, 0x42, 0x43, 0x44] }
221
219
  let(:raw) { bytes.map(&:chr) }
222
220
  let(:data) { raw.join }
223
- let(:type) { Hexdump::TYPES[:int8] }
224
-
225
- subject { described_class.new(type) }
221
+ let(:type) { Hexdump::TYPES[:uint8] }
226
222
 
227
223
  it "must yield each byte" do
228
224
  expect { |b|
@@ -239,8 +235,6 @@ describe Hexdump::Reader do
239
235
  let(:raw) { uints.map { |uint| [uint].pack('S<') } }
240
236
  let(:data) { raw.join }
241
237
 
242
- subject { described_class.new(type) }
243
-
244
238
  it "must decode the bytes in little-endian order" do
245
239
  expect { |b|
246
240
  subject.each_uint(data,&b)
@@ -273,8 +267,6 @@ describe Hexdump::Reader do
273
267
  let(:raw) { uints.map { |uint| [uint].pack('S>') } }
274
268
  let(:data) { raw.join }
275
269
 
276
- subject { described_class.new(type) }
277
-
278
270
  it "must decode the bytes in big-endian order" do
279
271
  expect { |b|
280
272
  subject.each_uint(data,&b)
@@ -311,8 +303,6 @@ describe Hexdump::Reader do
311
303
  let(:raw) { uints.map { |uint| [uint].pack('L<') } }
312
304
  let(:data) { raw.join }
313
305
 
314
- subject { described_class.new(type) }
315
-
316
306
  it "must decode the bytes in little-endian order" do
317
307
  expect { |b|
318
308
  subject.each_uint(data,&b)
@@ -345,8 +335,6 @@ describe Hexdump::Reader do
345
335
  let(:raw) { uints.map { |uint| [uint].pack('L>') } }
346
336
  let(:data) { raw.join }
347
337
 
348
- subject { described_class.new(type) }
349
-
350
338
  it "must decode the bytes in big-endian order" do
351
339
  expect { |b|
352
340
  subject.each_uint(data,&b)
@@ -383,8 +371,6 @@ describe Hexdump::Reader do
383
371
  let(:raw) { uints.map { |uint| [uint].pack('Q<') } }
384
372
  let(:data) { raw.join }
385
373
 
386
- subject { described_class.new(type) }
387
-
388
374
  it "must decode the bytes in little-endian order" do
389
375
  expect { |b|
390
376
  subject.each_uint(data,&b)
@@ -417,8 +403,6 @@ describe Hexdump::Reader do
417
403
  let(:raw) { uints.map { |uint| [uint].pack('Q>') } }
418
404
  let(:data) { raw.join }
419
405
 
420
- subject { described_class.new(type) }
421
-
422
406
  it "must decode the bytes in big-endian order" do
423
407
  expect { |b|
424
408
  subject.each_uint(data,&b)
@@ -463,8 +447,6 @@ describe Hexdump::Reader do
463
447
  let(:raw) { ints.map { |int| [int].pack('c') } }
464
448
  let(:data) { raw.join }
465
449
 
466
- subject { described_class.new(type) }
467
-
468
450
  it "must decode the bytes" do
469
451
  expect { |b|
470
452
  subject.each_int(data,&b)
@@ -480,8 +462,6 @@ describe Hexdump::Reader do
480
462
  let(:raw) { ints.map { |int| [int].pack('s<') } }
481
463
  let(:data) { raw.join }
482
464
 
483
- subject { described_class.new(type) }
484
-
485
465
  it "must decode the bytes in little-endian order" do
486
466
  expect { |b|
487
467
  subject.each_int(data,&b)
@@ -489,7 +469,7 @@ describe Hexdump::Reader do
489
469
  end
490
470
 
491
471
  context "but there is not enough bytes to decode a value" do
492
- let(:data) { "\x01".encode(Encoding::BINARY) }
472
+ let(:data) { "\x11".encode(Encoding::BINARY) }
493
473
 
494
474
  it "must yield the remaining bytes and nil" do
495
475
  expect { |b|
@@ -503,7 +483,7 @@ describe Hexdump::Reader do
503
483
  it "must yield the zero-padded data and partially decoded int" do
504
484
  expect { |b|
505
485
  subject.each_int(data,&b)
506
- }.to yield_with_args("#{data}\x00",0x01)
486
+ }.to yield_with_args("#{data}\x00",0x11)
507
487
  end
508
488
  end
509
489
  end
@@ -514,8 +494,6 @@ describe Hexdump::Reader do
514
494
  let(:raw) { ints.map { |int| [int].pack('s>') } }
515
495
  let(:data) { raw.join }
516
496
 
517
- subject { described_class.new(type) }
518
-
519
497
  it "must decode the bytes in big-endian order" do
520
498
  expect { |b|
521
499
  subject.each_int(data,&b)
@@ -523,7 +501,7 @@ describe Hexdump::Reader do
523
501
  end
524
502
 
525
503
  context "but there is not enough bytes to decode a value" do
526
- let(:data) { "\x01".encode(Encoding::BINARY) }
504
+ let(:data) { "\x11".encode(Encoding::BINARY) }
527
505
 
528
506
  it "must yield the remaining bytes and nil" do
529
507
  expect { |b|
@@ -537,7 +515,7 @@ describe Hexdump::Reader do
537
515
  it "must yield the zero-padded data and partially decoded int" do
538
516
  expect { |b|
539
517
  subject.each_int(data,&b)
540
- }.to yield_with_args("#{data}\x00",0x0100)
518
+ }.to yield_with_args("#{data}\x00",0x1100)
541
519
  end
542
520
  end
543
521
  end
@@ -552,8 +530,6 @@ describe Hexdump::Reader do
552
530
  let(:raw) { ints.map { |int| [int].pack('l<') } }
553
531
  let(:data) { raw.join }
554
532
 
555
- subject { described_class.new(type) }
556
-
557
533
  it "must decode the bytes in little-endian order" do
558
534
  expect { |b|
559
535
  subject.each_int(data,&b)
@@ -561,7 +537,7 @@ describe Hexdump::Reader do
561
537
  end
562
538
 
563
539
  context "but there is not enough bytes to decode a value" do
564
- let(:data) { "\x01\x02\x03".encode(Encoding::BINARY) }
540
+ let(:data) { "\x11\x22\x33".encode(Encoding::BINARY) }
565
541
 
566
542
  it "must yield the remaining bytes and nil" do
567
543
  expect { |b|
@@ -575,7 +551,7 @@ describe Hexdump::Reader do
575
551
  it "must yield the zero-padded data and partially decoded int" do
576
552
  expect { |b|
577
553
  subject.each_int(data,&b)
578
- }.to yield_with_args("#{data}\x00",0x00030201)
554
+ }.to yield_with_args("#{data}\x00",0x00332211)
579
555
  end
580
556
  end
581
557
  end
@@ -586,8 +562,6 @@ describe Hexdump::Reader do
586
562
  let(:raw) { ints.map { |int| [int].pack('l>') } }
587
563
  let(:data) { raw.join }
588
564
 
589
- subject { described_class.new(type) }
590
-
591
565
  it "must decode the bytes in big-endian order" do
592
566
  expect { |b|
593
567
  subject.each_int(data,&b)
@@ -595,7 +569,7 @@ describe Hexdump::Reader do
595
569
  end
596
570
 
597
571
  context "but there is not enough bytes to decode a value" do
598
- let(:data) { "\x01\x02\x03".encode(Encoding::BINARY) }
572
+ let(:data) { "\x11\x22\x33".encode(Encoding::BINARY) }
599
573
 
600
574
  it "must yield the remaining bytes and nil" do
601
575
  expect { |b|
@@ -609,7 +583,7 @@ describe Hexdump::Reader do
609
583
  it "must yield the zero-padded data and partially decoded int" do
610
584
  expect { |b|
611
585
  subject.each_int(data,&b)
612
- }.to yield_with_args("#{data}\x00",0x01020300)
586
+ }.to yield_with_args("#{data}\x00",0x11223300)
613
587
  end
614
588
  end
615
589
  end
@@ -624,8 +598,6 @@ describe Hexdump::Reader do
624
598
  let(:raw) { ints.map { |int| [int].pack('q<') } }
625
599
  let(:data) { raw.join }
626
600
 
627
- subject { described_class.new(type) }
628
-
629
601
  it "must decode the bytes in little-endian order" do
630
602
  expect { |b|
631
603
  subject.each_int(data,&b)
@@ -633,7 +605,7 @@ describe Hexdump::Reader do
633
605
  end
634
606
 
635
607
  context "but there is not enough bytes to decode a value" do
636
- let(:data) { "\x01\x02\x03\x04\x05\x06\x07".encode(Encoding::BINARY) }
608
+ let(:data) { "\x11\x22\x33\x44\x55\x66\x77".encode(Encoding::BINARY) }
637
609
 
638
610
  it "must yield the remaining bytes and nil" do
639
611
  expect { |b|
@@ -647,7 +619,7 @@ describe Hexdump::Reader do
647
619
  it "must yield the zero-padded data and partially decoded int" do
648
620
  expect { |b|
649
621
  subject.each_int(data,&b)
650
- }.to yield_with_args("#{data}\x00",0x0007060504030201)
622
+ }.to yield_with_args("#{data}\x00",0x0077665544332211)
651
623
  end
652
624
  end
653
625
  end
@@ -658,8 +630,6 @@ describe Hexdump::Reader do
658
630
  let(:raw) { ints.map { |int| [int].pack('q>') } }
659
631
  let(:data) { raw.join }
660
632
 
661
- subject { described_class.new(type) }
662
-
663
633
  it "must decode the bytes in big-endian order" do
664
634
  expect { |b|
665
635
  subject.each_int(data,&b)
@@ -667,7 +637,7 @@ describe Hexdump::Reader do
667
637
  end
668
638
 
669
639
  context "but there is not enough bytes to decode a value" do
670
- let(:data) { "\x01\x02\x03\x04\x05\x06\x07".encode(Encoding::BINARY) }
640
+ let(:data) { "\x11\x22\x33\x44\x55\x66\x77".encode(Encoding::BINARY) }
671
641
 
672
642
  it "must yield nil and the remaining bytes" do
673
643
  expect { |b|
@@ -681,7 +651,7 @@ describe Hexdump::Reader do
681
651
  it "must yield the zero-padded data and partially decoded int" do
682
652
  expect { |b|
683
653
  subject.each_int(data,&b)
684
- }.to yield_with_args("#{data}\x00",0x0102030405060700)
654
+ }.to yield_with_args("#{data}\x00",0x1122334455667700)
685
655
  end
686
656
  end
687
657
  end
@@ -698,6 +668,8 @@ describe Hexdump::Reader do
698
668
  end
699
669
 
700
670
  describe "#each_float" do
671
+ let(:type) { Hexdump::TYPES[:float] }
672
+
701
673
  context "when the type has size of 4" do
702
674
  let(:floats) { [1.0, -3.0, 5.0, -7.0, 9.0] }
703
675
 
@@ -706,8 +678,6 @@ describe Hexdump::Reader do
706
678
  let(:raw) { floats.map { |float| [float].pack('e') } }
707
679
  let(:data) { raw.join }
708
680
 
709
- subject { described_class.new(type) }
710
-
711
681
  it "must decode the bytes in little-endian order" do
712
682
  expect { |b|
713
683
  subject.each_float(data,&b)
@@ -726,7 +696,7 @@ describe Hexdump::Reader do
726
696
  context "but #zero_pad? is true" do
727
697
  subject { described_class.new(type, zero_pad: true) }
728
698
 
729
- it "must yield the zero-padded data and partially decoded int" do
699
+ it "must yield the zero-padded data and partially decoded float" do
730
700
  expect { |b|
731
701
  subject.each_float(data,&b)
732
702
  }.to yield_with_args("#{data}\x00",2.7622535458617227e-40)
@@ -740,8 +710,6 @@ describe Hexdump::Reader do
740
710
  let(:raw) { floats.map { |float| [float].pack('g') } }
741
711
  let(:data) { raw.join }
742
712
 
743
- subject { described_class.new(type) }
744
-
745
713
  it "must decode the bytes in big-endian order" do
746
714
  expect { |b|
747
715
  subject.each_float(data,&b)
@@ -760,7 +728,7 @@ describe Hexdump::Reader do
760
728
  context "but #zero_pad? is true" do
761
729
  subject { described_class.new(type, zero_pad: true) }
762
730
 
763
- it "must yield the zero-padded data and partially decoded int" do
731
+ it "must yield the zero-padded data and partially decoded float" do
764
732
  expect { |b|
765
733
  subject.each_float(data,&b)
766
734
  }.to yield_with_args("#{data}\x00",2.387938139551892e-38)
@@ -778,8 +746,6 @@ describe Hexdump::Reader do
778
746
  let(:raw) { floats.map { |float| [float].pack('E') } }
779
747
  let(:data) { raw.join }
780
748
 
781
- subject { described_class.new(type) }
782
-
783
749
  it "must decode the bytes in little-endian order" do
784
750
  expect { |b|
785
751
  subject.each_float(data,&b)
@@ -798,7 +764,7 @@ describe Hexdump::Reader do
798
764
  context "but #zero_pad? is true" do
799
765
  subject { described_class.new(type, zero_pad: true) }
800
766
 
801
- it "must yield the zero-padded data and partially decoded int" do
767
+ it "must yield the zero-padded data and partially decoded float" do
802
768
  expect { |b|
803
769
  subject.each_float(data,&b)
804
770
  }.to yield_with_args("#{data}\x00",9.76739841864353e-309)
@@ -812,8 +778,6 @@ describe Hexdump::Reader do
812
778
  let(:raw) { floats.map { |float| [float].pack('G') } }
813
779
  let(:data) { raw.join }
814
780
 
815
- subject { described_class.new(type) }
816
-
817
781
  it "must decode the bytes in big-endian order" do
818
782
  expect { |b|
819
783
  subject.each_float(data,&b)
@@ -832,7 +796,7 @@ describe Hexdump::Reader do
832
796
  context "but #zero_pad? is true" do
833
797
  subject { described_class.new(type, zero_pad: true) }
834
798
 
835
- it "must yield the zero-padded data and partially decoded int" do
799
+ it "must yield the zero-padded data and partially decoded float" do
836
800
  expect { |b|
837
801
  subject.each_float(data,&b)
838
802
  }.to yield_with_args("#{data}\x00",8.207880399131826e-304)
@@ -852,6 +816,45 @@ describe Hexdump::Reader do
852
816
  end
853
817
 
854
818
  describe "#each" do
819
+ context "when #type is a UInt" do
820
+ let(:type) { Hexdump::TYPES[:uint32] }
821
+ let(:uints) { [1, 2, 3] }
822
+ let(:raw) { uints.map { |uint| [uint].pack('L') } }
823
+ let(:data) { raw.join }
824
+
825
+ it "must yield decoded integers" do
826
+ expect { |b|
827
+ subject.each(data,&b)
828
+ }.to yield_successive_args(*raw.zip(uints))
829
+ end
830
+ end
831
+
832
+ context "when #type is a Int" do
833
+ let(:type) { Hexdump::TYPES[:int32] }
834
+ let(:ints) { [1, 2, 3] }
835
+ let(:raw) { ints.map { |int| [int].pack('l') } }
836
+ let(:data) { raw.join }
837
+
838
+ it "must yield decoded integers" do
839
+ expect { |b|
840
+ subject.each(data,&b)
841
+ }.to yield_successive_args(*raw.zip(ints))
842
+ end
843
+ end
844
+
845
+ context "when #type is a Float" do
846
+ let(:type) { Hexdump::TYPES[:float] }
847
+ let(:floats) { [1.0, 2.0, 3.0] }
848
+ let(:raw) { floats.map { |float| [float].pack('e') } }
849
+ let(:data) { raw.join }
850
+
851
+ it "must yield decoded integers" do
852
+ expect { |b|
853
+ subject.each(data,&b)
854
+ }.to yield_successive_args(*raw.zip(floats))
855
+ end
856
+ end
857
+
855
858
  context "when the given data does not define #each_byte" do
856
859
  it do
857
860
  expect {
data/spec/spec_helper.rb CHANGED
@@ -1 +1,3 @@
1
1
  require 'rspec'
2
+ require 'simplecov'
3
+ SimpleCov.start
data/spec/types_spec.rb CHANGED
@@ -448,25 +448,25 @@ describe "Hexdump::TYPES" do
448
448
 
449
449
  describe "long" do
450
450
  it "must be an alias to int32" do
451
- expect(subject[:long]).to be(subject[:int32])
451
+ expect(subject[:long]).to be(subject[:int64])
452
452
  end
453
453
  end
454
454
 
455
455
  describe "long_le" do
456
456
  it "must be an alias to int32_le" do
457
- expect(subject[:long_le]).to be(subject[:int32_le])
457
+ expect(subject[:long_le]).to be(subject[:int64_le])
458
458
  end
459
459
  end
460
460
 
461
461
  describe "long_be" do
462
462
  it "must be an alias to int32_be" do
463
- expect(subject[:long_be]).to be(subject[:int32_be])
463
+ expect(subject[:long_be]).to be(subject[:int64_be])
464
464
  end
465
465
  end
466
466
 
467
467
  describe "long_ne" do
468
468
  it "must be an alias to int32_ne" do
469
- expect(subject[:long_ne]).to be(subject[:int32_ne])
469
+ expect(subject[:long_ne]).to be(subject[:int64_ne])
470
470
  end
471
471
  end
472
472
 
@@ -496,25 +496,25 @@ describe "Hexdump::TYPES" do
496
496
 
497
497
  describe "ulong" do
498
498
  it "must be an alias to uint32" do
499
- expect(subject[:ulong]).to be(subject[:uint32])
499
+ expect(subject[:ulong]).to be(subject[:uint64])
500
500
  end
501
501
  end
502
502
 
503
503
  describe "ulong_le" do
504
504
  it "must be an alias to uint32_le" do
505
- expect(subject[:ulong_le]).to be(subject[:uint32_le])
505
+ expect(subject[:ulong_le]).to be(subject[:uint64_le])
506
506
  end
507
507
  end
508
508
 
509
509
  describe "ulong_be" do
510
510
  it "must be an alias to uint32_be" do
511
- expect(subject[:ulong_be]).to be(subject[:uint32_be])
511
+ expect(subject[:ulong_be]).to be(subject[:uint64_be])
512
512
  end
513
513
  end
514
514
 
515
515
  describe "ulong_ne" do
516
516
  it "must be an alias to uint32_ne" do
517
- expect(subject[:ulong_ne]).to be(subject[:uint32_ne])
517
+ expect(subject[:ulong_ne]).to be(subject[:uint64_ne])
518
518
  end
519
519
  end
520
520
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexdump
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2024-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
- description: Simple and Fast hexdumping for Ruby.
27
+ description: Fully Featured and Fast hexdumping for Ruby.
28
28
  email: postmodern.mod3@gmail.com
29
29
  executables: []
30
30
  extensions: []
@@ -54,7 +54,6 @@ files:
54
54
  - lib/hexdump/core_ext/kernel.rb
55
55
  - lib/hexdump/core_ext/string.rb
56
56
  - lib/hexdump/core_ext/string_io.rb
57
- - lib/hexdump/extensions.rb
58
57
  - lib/hexdump/format_string.rb
59
58
  - lib/hexdump/hexdump.rb
60
59
  - lib/hexdump/mixin.rb
@@ -75,6 +74,7 @@ files:
75
74
  - lib/hexdump/version.rb
76
75
  - spec/chars_spec.rb
77
76
  - spec/core_ext_spec.rb
77
+ - spec/format_string_spec.rb
78
78
  - spec/hexdump_class_spec.rb
79
79
  - spec/hexdump_module_spec.rb
80
80
  - spec/mixin_spec.rb
@@ -98,6 +98,7 @@ metadata:
98
98
  source_code_uri: https://github.com/postmodern/hexdump.rb
99
99
  bug_tracker_uri: https://github.com/postmodern/hexdump.rb/issues
100
100
  changelog_uri: https://github.com/postmodern/hexdump.rb/blob/master/ChangeLog.md
101
+ rubygems_mfa_required: 'true'
101
102
  post_install_message:
102
103
  rdoc_options: []
103
104
  require_paths:
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  - !ruby/object:Gem::Version
114
115
  version: '0'
115
116
  requirements: []
116
- rubygems_version: 3.2.22
117
+ rubygems_version: 3.4.10
117
118
  signing_key:
118
119
  specification_version: 4
119
120
  summary: Hexdump Strings and IO objects.
@@ -1,2 +0,0 @@
1
- # DEPRECATED: use hexdump/core_ext instead.
2
- require 'hexdump/core_ext'