hexdump 0.2.4 → 0.3.0
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 +3 -5
- data/ChangeLog.md +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +99 -78
- data/benchmark.rb +47 -0
- data/gemspec.yml +8 -2
- data/hexdump.gemspec +1 -0
- data/lib/hexdump.rb +1 -1
- data/lib/hexdump/core_ext.rb +4 -0
- data/lib/hexdump/{extensions → core_ext}/file.rb +0 -0
- data/lib/hexdump/{extensions → core_ext}/io.rb +0 -0
- data/lib/hexdump/{extensions → core_ext}/string.rb +0 -0
- data/lib/hexdump/{extensions → core_ext}/string_io.rb +0 -0
- data/lib/hexdump/dumper.rb +61 -91
- data/lib/hexdump/extensions.rb +2 -4
- data/lib/hexdump/hexdump.rb +12 -21
- data/lib/hexdump/version.rb +1 -1
- data/spec/{extensions_spec.rb → core_ext_spec.rb} +2 -2
- data/spec/dumper_spec.rb +176 -107
- data/spec/hexdump_spec.rb +0 -1
- metadata +17 -12
- data/benchmarks/hexdump.rb +0 -45
    
        data/spec/hexdump_spec.rb
    CHANGED
    
    
    
        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: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Postmodern
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-04-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -44,26 +44,31 @@ files: | |
| 44 44 | 
             
            - LICENSE.txt
         | 
| 45 45 | 
             
            - README.md
         | 
| 46 46 | 
             
            - Rakefile
         | 
| 47 | 
            -
            -  | 
| 47 | 
            +
            - benchmark.rb
         | 
| 48 48 | 
             
            - gemspec.yml
         | 
| 49 49 | 
             
            - hexdump.gemspec
         | 
| 50 50 | 
             
            - lib/hexdump.rb
         | 
| 51 | 
            +
            - lib/hexdump/core_ext.rb
         | 
| 52 | 
            +
            - lib/hexdump/core_ext/file.rb
         | 
| 53 | 
            +
            - lib/hexdump/core_ext/io.rb
         | 
| 54 | 
            +
            - lib/hexdump/core_ext/string.rb
         | 
| 55 | 
            +
            - lib/hexdump/core_ext/string_io.rb
         | 
| 51 56 | 
             
            - lib/hexdump/dumper.rb
         | 
| 52 57 | 
             
            - lib/hexdump/extensions.rb
         | 
| 53 | 
            -
            - lib/hexdump/extensions/file.rb
         | 
| 54 | 
            -
            - lib/hexdump/extensions/io.rb
         | 
| 55 | 
            -
            - lib/hexdump/extensions/string.rb
         | 
| 56 | 
            -
            - lib/hexdump/extensions/string_io.rb
         | 
| 57 58 | 
             
            - lib/hexdump/hexdump.rb
         | 
| 58 59 | 
             
            - lib/hexdump/version.rb
         | 
| 60 | 
            +
            - spec/core_ext_spec.rb
         | 
| 59 61 | 
             
            - spec/dumper_spec.rb
         | 
| 60 | 
            -
            - spec/extensions_spec.rb
         | 
| 61 62 | 
             
            - spec/hexdump_spec.rb
         | 
| 62 63 | 
             
            - spec/spec_helper.rb
         | 
| 63 | 
            -
            homepage: https://github.com/postmodern/hexdump#readme
         | 
| 64 | 
            +
            homepage: https://github.com/postmodern/hexdump.rb#readme
         | 
| 64 65 | 
             
            licenses:
         | 
| 65 66 | 
             
            - MIT
         | 
| 66 | 
            -
            metadata: | 
| 67 | 
            +
            metadata:
         | 
| 68 | 
            +
              documentation_uri: https://rubydoc.info/gems/hexdump
         | 
| 69 | 
            +
              source_code_uri: https://github.com/postmodern/hexdump.rb
         | 
| 70 | 
            +
              bug_tracker_uri: https://github.com/postmodern/hexdump.rb/issues
         | 
| 71 | 
            +
              changelog_uri: https://github.com/postmodern/hexdump.rb/blob/master/ChangeLog.md
         | 
| 67 72 | 
             
            post_install_message: 
         | 
| 68 73 | 
             
            rdoc_options: []
         | 
| 69 74 | 
             
            require_paths:
         | 
| @@ -72,14 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 72 77 | 
             
              requirements:
         | 
| 73 78 | 
             
              - - ">="
         | 
| 74 79 | 
             
                - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                  version:  | 
| 80 | 
            +
                  version: 2.0.0
         | 
| 76 81 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 77 82 | 
             
              requirements:
         | 
| 78 83 | 
             
              - - ">="
         | 
| 79 84 | 
             
                - !ruby/object:Gem::Version
         | 
| 80 85 | 
             
                  version: '0'
         | 
| 81 86 | 
             
            requirements: []
         | 
| 82 | 
            -
            rubygems_version: 3.1. | 
| 87 | 
            +
            rubygems_version: 3.1.6
         | 
| 83 88 | 
             
            signing_key: 
         | 
| 84 89 | 
             
            specification_version: 4
         | 
| 85 90 | 
             
            summary: Hexdump Strings and IO objects.
         | 
    
        data/benchmarks/hexdump.rb
    DELETED
    
    | @@ -1,45 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            require 'hexdump'
         | 
| 6 | 
            -
            require 'benchmark'
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            DATA = ((0..255).map { |b| b.chr }.join) * 10000
         | 
| 9 | 
            -
            OUTPUT = Class.new { def <<(data); end }.new
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            Benchmark.bm(27) do |b|
         | 
| 12 | 
            -
              b.report('hexdump (block)') do
         | 
| 13 | 
            -
                Hexdump.dump(DATA) { |index,hex,print| }
         | 
| 14 | 
            -
              end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
              b.report('hexdump') do
         | 
| 17 | 
            -
                Hexdump.dump(DATA, :output => OUTPUT)
         | 
| 18 | 
            -
              end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
              b.report('hexdump width=256 (block)') do
         | 
| 21 | 
            -
                Hexdump.dump(DATA, :width => 256) { |index,hex,print| }
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              b.report('hexdump width=256') do
         | 
| 25 | 
            -
                Hexdump.dump(DATA, :width => 256, :output => OUTPUT)
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              b.report('hexdump ascii=true (block)') do
         | 
| 29 | 
            -
                Hexdump.dump(DATA, :ascii => true) { |index,hex,print| }
         | 
| 30 | 
            -
              end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
              b.report('hexdump ascii=true') do
         | 
| 33 | 
            -
                Hexdump.dump(DATA, :ascii => true, :output => OUTPUT)
         | 
| 34 | 
            -
              end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
              [2, 4, 8].each do |word_size|
         | 
| 37 | 
            -
                b.report("hexdump word_size=#{word_size} (block)") do
         | 
| 38 | 
            -
                  Hexdump.dump(DATA, :word_size => word_size) { |index,hex,print| }
         | 
| 39 | 
            -
                end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                b.report("hexdump word_size=#{word_size}") do
         | 
| 42 | 
            -
                  Hexdump.dump(DATA, :word_size => word_size, :output => OUTPUT)
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
              end
         | 
| 45 | 
            -
            end
         |