zhexdump 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/zhexdump/version.rb +1 -1
  3. data/lib/zhexdump.rb +11 -8
  4. metadata +14 -19
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8b2e6bfef9bdafb2b9c55ca2682113a71e008e5e9fc5d2492e0a03f7fbb74abb
4
+ data.tar.gz: 6c8ffe4c3d33f5c1fbe2c79dd02263f5b57582abb7c12950d54def6e8e942ff3
5
+ SHA512:
6
+ metadata.gz: f6fe0c14cdf444797c7393def5d1949ad319fc93f86075efecc7f083e012d87e210f78530340cb4401919905445c2f7f79581b1fe45f7348c79a367629ae1090
7
+ data.tar.gz: 4c86d845b5820ac1ab2b51293e290cb3b8877005b80316355ae0e40b234d245f05560c80f3617791a14c47bdcd18e0b16a0c7314e5b811ba7104cb01a9730314
@@ -1,3 +1,3 @@
1
1
  module ZHexdump
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/zhexdump.rb CHANGED
@@ -30,12 +30,15 @@ module ZHexdump
30
30
  offset = 0
31
31
  end
32
32
 
33
- add = h[:add] || 0
34
- size = h[:size] || (data.size-offset)
35
- tail = h[:tail] || "\n"
36
- width = h[:width] || 0x10 # row width, in bytes
37
- output = h[:output] || $>
38
-
33
+ add = h[:add] || 0
34
+ size = h[:size] || (data.size-offset)
35
+ tail = h[:tail] || "\n"
36
+ width = h[:width] || 0x10 # row width, in bytes
37
+ output = h[:output] || $>
38
+ indent = h[:indent] || 0
39
+ offset_format = h[:offset_format] || "%08x: "
40
+
41
+ indent = ' ' * indent
39
42
  size = data.size-offset if size+offset > data.size
40
43
 
41
44
  prevhex = ''; c = nil; prevdup = false; start = offset
@@ -62,7 +65,7 @@ module ZHexdump
62
65
  end
63
66
  prevdup = true
64
67
  else
65
- row = (show_offset ? ("%08x: " % (offset + add)) : '') + hex
68
+ row = indent + (show_offset ? (offset_format % (offset + add)) : '') + hex
66
69
  yield(row, offset+add, ascii) if block_given?
67
70
  row << ' |' + ascii + "|"
68
71
  output << "\n" if offset > start
@@ -75,7 +78,7 @@ module ZHexdump
75
78
  break if size <= 0
76
79
  end
77
80
  if show_offset && prevdup
78
- row = "%08x: " % (offset + add)
81
+ row = indent + (offset_format % (offset + add))
79
82
  yield(row) if block_given?
80
83
  output << "\n" << row
81
84
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zhexdump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Andrey "Zed" Zaikin
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
11
+ date: 2024-04-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: A highly flexible hexdump implementation.
@@ -34,8 +31,8 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
37
- - .gitignore
38
- - .rspec
34
+ - ".gitignore"
35
+ - ".rspec"
39
36
  - Gemfile
40
37
  - LICENSE.txt
41
38
  - README.md
@@ -48,27 +45,25 @@ files:
48
45
  - zhexdump.gemspec
49
46
  homepage: ''
50
47
  licenses: []
51
- post_install_message:
48
+ metadata: {}
49
+ post_install_message:
52
50
  rdoc_options: []
53
51
  require_paths:
54
52
  - lib
55
53
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
- - - ! '>='
55
+ - - ">="
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0'
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
- - - ! '>='
60
+ - - ">="
65
61
  - !ruby/object:Gem::Version
66
62
  version: '0'
67
63
  requirements: []
68
- rubyforge_project:
69
- rubygems_version: 1.8.24
70
- signing_key:
71
- specification_version: 3
64
+ rubygems_version: 3.5.6
65
+ signing_key:
66
+ specification_version: 4
72
67
  summary: A highly flexible hexdump implementation.
73
68
  test_files:
74
69
  - spec/hexdump_spec.rb