debug_helper 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +9 -9
  3. data/.travis.yml +5 -5
  4. data/CODE_OF_CONDUCT.md +74 -74
  5. data/Gemfile +6 -6
  6. data/Gemfile.lock +3 -1
  7. data/LICENSE.txt +21 -21
  8. data/README.md +119 -88
  9. data/Rakefile +10 -10
  10. data/bin/setup +8 -8
  11. data/debug_helper.gemspec +38 -37
  12. data/lib/debug_helper.rb +1 -0
  13. data/lib/debug_helper/method_handler.rb +20 -0
  14. data/lib/debug_helper/version.rb +1 -1
  15. data/markdown/readme/Rakefile +1 -0
  16. data/markdown/readme/class_inclusions.md +1 -0
  17. data/markdown/readme/class_links.md +1 -0
  18. data/markdown/readme/classes/array/mixed/show.md +1 -1
  19. data/markdown/readme/classes/array/mixed/show.yaml +1 -1
  20. data/markdown/readme/classes/array/nested/show.md +5 -5
  21. data/markdown/readme/classes/array/nested/show.yaml +5 -5
  22. data/markdown/readme/classes/array/simple/show.md +3 -3
  23. data/markdown/readme/classes/array/simple/show.yaml +3 -3
  24. data/markdown/readme/classes/file/simple/show.md +25 -20
  25. data/markdown/readme/classes/file/simple/show.rb +7 -2
  26. data/markdown/readme/classes/file/simple/show.yaml +18 -18
  27. data/markdown/readme/classes/hash/mixed/show.md +1 -1
  28. data/markdown/readme/classes/hash/mixed/show.yaml +1 -1
  29. data/markdown/readme/classes/hash/nested/show.md +4 -4
  30. data/markdown/readme/classes/hash/nested/show.yaml +4 -4
  31. data/markdown/readme/classes/hash/simple/show.md +3 -3
  32. data/markdown/readme/classes/hash/simple/show.yaml +3 -3
  33. data/markdown/readme/classes/method/simple/show.md +28 -0
  34. data/markdown/readme/classes/method/simple/show.rb +4 -0
  35. data/markdown/readme/classes/method/simple/show.yaml +11 -0
  36. data/markdown/readme/classes/method/simple/template.md +9 -0
  37. data/markdown/readme/classes/method/template.md +3 -0
  38. data/markdown/readme/classes/object/object/show.md +0 -1
  39. data/markdown/readme/classes/object/object/show.yaml +0 -1
  40. data/markdown/readme/classes/open_struct/mixed/show.md +1 -1
  41. data/markdown/readme/classes/open_struct/mixed/show.yaml +1 -1
  42. data/markdown/readme/classes/open_struct/nested/show.md +4 -4
  43. data/markdown/readme/classes/open_struct/nested/show.yaml +4 -4
  44. data/markdown/readme/classes/open_struct/simple/show.md +3 -3
  45. data/markdown/readme/classes/open_struct/simple/show.yaml +3 -3
  46. data/markdown/readme/classes/set/mixed/show.md +1 -1
  47. data/markdown/readme/classes/set/mixed/show.yaml +1 -1
  48. data/markdown/readme/classes/set/nested/show.md +5 -5
  49. data/markdown/readme/classes/set/nested/show.yaml +5 -5
  50. data/markdown/readme/classes/set/simple/show.md +3 -3
  51. data/markdown/readme/classes/set/simple/show.yaml +3 -3
  52. data/markdown/readme/classes/struct/circular/show.md +4 -4
  53. data/markdown/readme/classes/struct/circular/show.yaml +4 -4
  54. data/markdown/readme/classes/struct/mixed/show.md +1 -1
  55. data/markdown/readme/classes/struct/mixed/show.yaml +1 -1
  56. data/markdown/readme/classes/struct/nested/show.md +4 -4
  57. data/markdown/readme/classes/struct/nested/show.yaml +4 -4
  58. data/markdown/readme/classes/struct/simple/show.md +3 -3
  59. data/markdown/readme/classes/struct/simple/show.yaml +3 -3
  60. data/markdown/readme/options/depth/show.md +15 -15
  61. data/markdown/readme/options/depth/show.yaml +15 -15
  62. data/markdown/readme/template.md +2 -6
  63. metadata +23 -3
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,37 +1,38 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "debug_helper/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "debug_helper"
8
- spec.version = DebugHelper::VERSION
9
- spec.authors = ["burdettelamar"]
10
- spec.email = ["burdettelamar@yahoo.com"]
11
-
12
- spec.summary = %q{Help for printf-style debugging.}
13
- spec.homepage = "https://github.com/BurdetteLamar/debug_helper"
14
- spec.license = "MIT"
15
-
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- # if spec.respond_to?(:metadata)
19
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
- # else
21
- # raise "RubyGems 2.0 or newer is required to protect against " \
22
- # "public gem pushes."
23
- # end
24
-
25
- # Specify which files should be added to the gem when it is released.
26
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
- end
30
- spec.bindir = "bin"
31
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- spec.add_development_dependency "bundler", "~> 1.16"
35
- spec.add_development_dependency "rake", "~> 10.0"
36
- spec.add_development_dependency "minitest", "~> 5.0"
37
- end
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "debug_helper/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "debug_helper"
8
+ spec.version = DebugHelper::VERSION
9
+ spec.authors = ["burdettelamar"]
10
+ spec.email = ["burdettelamar@yahoo.com"]
11
+
12
+ spec.summary = %q{Help for printf-style debugging.}
13
+ spec.homepage = "https://github.com/BurdetteLamar/debug_helper"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ # if spec.respond_to?(:metadata)
19
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
+ # else
21
+ # raise "RubyGems 2.0 or newer is required to protect against " \
22
+ # "public gem pushes."
23
+ # end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "bin"
31
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.16"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "minitest", "~> 5.0"
37
+ spec.add_development_dependency "diff-lcs", "~> 1.3"
38
+ end
@@ -20,6 +20,7 @@ require_relative 'debug_helper/handler'
20
20
  require_relative 'debug_helper/generic_handler'
21
21
  require_relative 'debug_helper/io_handler'
22
22
  require_relative 'debug_helper/match_data_handler'
23
+ require_relative 'debug_helper/method_handler'
23
24
  require_relative 'debug_helper/object_handler'
24
25
  require_relative 'debug_helper/open_struct_handler'
25
26
  require_relative 'debug_helper/regexp_handler'
@@ -0,0 +1,20 @@
1
+ class DebugHelper
2
+
3
+ class MethodHandler < Handler
4
+
5
+ def calls_for_instance
6
+ [
7
+ [:arity],
8
+ [:inspect],
9
+ [:name],
10
+ [:original_name],
11
+ [:owner],
12
+ [:parameters],
13
+ [:source_location],
14
+ [:super_method],
15
+ ]
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -1,3 +1,3 @@
1
1
  class DebugHelper
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -22,6 +22,7 @@ namespace :build do
22
22
  Hash
23
23
  IO
24
24
  MatchData
25
+ Method
25
26
  OpenStruct
26
27
  Range
27
28
  Regexp
@@ -5,6 +5,7 @@
5
5
  @[:markdown](classes/hash/template.md)
6
6
  @[:markdown](classes/io/template.md)
7
7
  @[:markdown](classes/match_data/template.md)
8
+ @[:markdown](classes/method/template.md)
8
9
  @[:markdown](classes/open_struct/template.md)
9
10
  @[:markdown](classes/range/template.md)
10
11
  @[:markdown](classes/regexp/template.md)
@@ -5,6 +5,7 @@
5
5
  - [Hash](#hash)
6
6
  - [IO](#io)
7
7
  - [MatchData](#matchdata)
8
+ - [Method](#method)
8
9
  - [OpenStruct](#openstruct)
9
10
  - [Range](#range)
10
11
  - [Regexp](#regexp)
@@ -17,7 +17,7 @@ The output shows details of the array.
17
17
  ---
18
18
  Array (message='My mixed array'):
19
19
  Array#size: 3
20
- Element 0: Fixnum 0
20
+ Element 0: Integer 0
21
21
  Element 1:
22
22
  String:
23
23
  String#to_s: one
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  Array (message='My mixed array'):
3
3
  Array#size: 3
4
- Element 0: Fixnum 0
4
+ Element 0: Integer 0
5
5
  Element 1:
6
6
  String:
7
7
  String#to_s: one
@@ -17,15 +17,15 @@ The output shows details of the arrays.
17
17
  ---
18
18
  Array (message='My nested arrays'):
19
19
  Array#size: 3
20
- Element 0: Fixnum 0
20
+ Element 0: Integer 0
21
21
  Element 1:
22
22
  Array:
23
23
  Array#size: 2
24
- Element 0: Fixnum 1
25
- Element 1: Fixnum 2
24
+ Element 0: Integer 1
25
+ Element 1: Integer 2
26
26
  Element 2:
27
27
  Array:
28
28
  Array#size: 2
29
- Element 0: Fixnum 3
30
- Element 1: Fixnum 4
29
+ Element 0: Integer 3
30
+ Element 1: Integer 4
31
31
  ```
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  Array (message='My nested arrays'):
3
3
  Array#size: 3
4
- Element 0: Fixnum 0
4
+ Element 0: Integer 0
5
5
  Element 1:
6
6
  Array:
7
7
  Array#size: 2
8
- Element 0: Fixnum 1
9
- Element 1: Fixnum 2
8
+ Element 0: Integer 1
9
+ Element 1: Integer 2
10
10
  Element 2:
11
11
  Array:
12
12
  Array#size: 2
13
- Element 0: Fixnum 3
14
- Element 1: Fixnum 4
13
+ Element 0: Integer 3
14
+ Element 1: Integer 4
@@ -17,7 +17,7 @@ The output shows details of the array.
17
17
  ---
18
18
  Array (message='My simple array'):
19
19
  Array#size: 3
20
- Element 0: Fixnum 5
21
- Element 1: Fixnum 10
22
- Element 2: Fixnum 15
20
+ Element 0: Integer 5
21
+ Element 1: Integer 10
22
+ Element 2: Integer 15
23
23
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  Array (message='My simple array'):
3
3
  Array#size: 3
4
- Element 0: Fixnum 5
5
- Element 1: Fixnum 10
6
- Element 2: Fixnum 15
4
+ Element 0: Integer 5
5
+ Element 1: Integer 10
6
+ Element 2: Integer 15
@@ -6,8 +6,13 @@ This example shows a simple file.
6
6
  ```ruby
7
7
  require 'debug_helper'
8
8
 
9
- file = File.new(__FILE__)
10
- DebugHelper.show(file, 'My simple file')
9
+ gem_file_path = `gem which debug_helper`.chomp
10
+ gem_dir_path = File.dirname(gem_file_path)
11
+ gem_file_name = File.basename(gem_file_path)
12
+ Dir.chdir(gem_dir_path) do
13
+ file = File.new(gem_file_name)
14
+ DebugHelper.show(file, 'Gem file')
15
+ end
11
16
  ```
12
17
 
13
18
  The output shows details of the file.
@@ -15,22 +20,22 @@ The output shows details of the file.
15
20
  ```show.yaml```:
16
21
  ```yaml
17
22
  ---
18
- File (message='My simple file'):
19
- File.absolute_path("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
20
- File.atime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
21
- File.ctime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
22
- File.executable?("show.rb"): false
23
- File.exist?("show.rb"): true
24
- File.ftype("show.rb"): file
25
- File.mtime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
26
- File.path("show.rb"): show.rb
27
- File.pipe?("show.rb"): false
28
- File.readable?("show.rb"): true
29
- File.realpath("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
30
- File.setgid?("show.rb"): false
31
- File.setuid?("show.rb"): false
32
- File.size("show.rb"): 95
33
- File.socket?("show.rb"): false
34
- File.symlink?("show.rb"): false
35
- File.writable?("show.rb"): true
23
+ File (message='Gem file'):
24
+ File.absolute_path("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb
25
+ File.atime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00
26
+ File.ctime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00
27
+ File.executable?("debug_helper.rb"): false
28
+ File.exist?("debug_helper.rb"): true
29
+ File.ftype("debug_helper.rb"): file
30
+ File.mtime("debug_helper.rb"): 2019-01-25 15:43:42.741296200 -06:00
31
+ File.path("debug_helper.rb"): debug_helper.rb
32
+ File.pipe?("debug_helper.rb"): false
33
+ File.readable?("debug_helper.rb"): true
34
+ File.realpath("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb
35
+ File.setgid?("debug_helper.rb"): false
36
+ File.setuid?("debug_helper.rb"): false
37
+ File.size("debug_helper.rb"): 3701
38
+ File.socket?("debug_helper.rb"): false
39
+ File.symlink?("debug_helper.rb"): false
40
+ File.writable?("debug_helper.rb"): true
36
41
  ```
@@ -1,4 +1,9 @@
1
1
  require 'debug_helper'
2
2
 
3
- file = File.new(__FILE__)
4
- DebugHelper.show(file, 'My simple file')
3
+ gem_file_path = `gem which debug_helper`.chomp
4
+ gem_dir_path = File.dirname(gem_file_path)
5
+ gem_file_name = File.basename(gem_file_path)
6
+ Dir.chdir(gem_dir_path) do
7
+ file = File.new(gem_file_name)
8
+ DebugHelper.show(file, 'Gem file')
9
+ end
@@ -1,19 +1,19 @@
1
1
  ---
2
- File (message='My simple file'):
3
- File.absolute_path("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
4
- File.atime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
5
- File.ctime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
6
- File.executable?("show.rb"): false
7
- File.exist?("show.rb"): true
8
- File.ftype("show.rb"): file
9
- File.mtime("show.rb"): 2018-07-14 12:45:32.000000000 -05:00
10
- File.path("show.rb"): show.rb
11
- File.pipe?("show.rb"): false
12
- File.readable?("show.rb"): true
13
- File.realpath("show.rb"): C:/Users/Burdette/Documents/GitHub/debug_helper/markdown/readme/classes/file/simple/show.rb
14
- File.setgid?("show.rb"): false
15
- File.setuid?("show.rb"): false
16
- File.size("show.rb"): 95
17
- File.socket?("show.rb"): false
18
- File.symlink?("show.rb"): false
19
- File.writable?("show.rb"): true
2
+ File (message='Gem file'):
3
+ File.absolute_path("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb
4
+ File.atime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00
5
+ File.ctime("debug_helper.rb"): 2019-01-25 15:43:42.740298400 -06:00
6
+ File.executable?("debug_helper.rb"): false
7
+ File.exist?("debug_helper.rb"): true
8
+ File.ftype("debug_helper.rb"): file
9
+ File.mtime("debug_helper.rb"): 2019-01-25 15:43:42.741296200 -06:00
10
+ File.path("debug_helper.rb"): debug_helper.rb
11
+ File.pipe?("debug_helper.rb"): false
12
+ File.readable?("debug_helper.rb"): true
13
+ File.realpath("debug_helper.rb"): C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/debug_helper-2.0.0/lib/debug_helper.rb
14
+ File.setgid?("debug_helper.rb"): false
15
+ File.setuid?("debug_helper.rb"): false
16
+ File.size("debug_helper.rb"): 3701
17
+ File.socket?("debug_helper.rb"): false
18
+ File.symlink?("debug_helper.rb"): false
19
+ File.writable?("debug_helper.rb"): true
@@ -29,7 +29,7 @@ Hash (message='My mixed hash'):
29
29
  Symbol#to_s: a
30
30
  Symbol#size: 1
31
31
  Symbol#encoding: !ruby/encoding US-ASCII
32
- Value: Fixnum 0
32
+ Value: Integer 0
33
33
  Pair 1:
34
34
  Key:
35
35
  Symbol:
@@ -9,7 +9,7 @@ Hash (message='My mixed hash'):
9
9
  Symbol#to_s: a
10
10
  Symbol#size: 1
11
11
  Symbol#encoding: !ruby/encoding US-ASCII
12
- Value: Fixnum 0
12
+ Value: Integer 0
13
13
  Pair 1:
14
14
  Key:
15
15
  Symbol:
@@ -45,14 +45,14 @@ Hash (message='My nested hash'):
45
45
  Symbol#to_s: b
46
46
  Symbol#size: 1
47
47
  Symbol#encoding: !ruby/encoding US-ASCII
48
- Value: Fixnum 0
48
+ Value: Integer 0
49
49
  Pair 1:
50
50
  Key:
51
51
  Symbol:
52
52
  Symbol#to_s: c
53
53
  Symbol#size: 1
54
54
  Symbol#encoding: !ruby/encoding US-ASCII
55
- Value: Fixnum 1
55
+ Value: Integer 1
56
56
  Pair 1:
57
57
  Key:
58
58
  Symbol:
@@ -70,12 +70,12 @@ Hash (message='My nested hash'):
70
70
  Symbol#to_s: e
71
71
  Symbol#size: 1
72
72
  Symbol#encoding: !ruby/encoding US-ASCII
73
- Value: Fixnum 2
73
+ Value: Integer 2
74
74
  Pair 1:
75
75
  Key:
76
76
  Symbol:
77
77
  Symbol#to_s: f
78
78
  Symbol#size: 1
79
79
  Symbol#encoding: !ruby/encoding US-ASCII
80
- Value: Fixnum 3
80
+ Value: Integer 3
81
81
  ```
@@ -20,14 +20,14 @@ Hash (message='My nested hash'):
20
20
  Symbol#to_s: b
21
21
  Symbol#size: 1
22
22
  Symbol#encoding: !ruby/encoding US-ASCII
23
- Value: Fixnum 0
23
+ Value: Integer 0
24
24
  Pair 1:
25
25
  Key:
26
26
  Symbol:
27
27
  Symbol#to_s: c
28
28
  Symbol#size: 1
29
29
  Symbol#encoding: !ruby/encoding US-ASCII
30
- Value: Fixnum 1
30
+ Value: Integer 1
31
31
  Pair 1:
32
32
  Key:
33
33
  Symbol:
@@ -45,11 +45,11 @@ Hash (message='My nested hash'):
45
45
  Symbol#to_s: e
46
46
  Symbol#size: 1
47
47
  Symbol#encoding: !ruby/encoding US-ASCII
48
- Value: Fixnum 2
48
+ Value: Integer 2
49
49
  Pair 1:
50
50
  Key:
51
51
  Symbol:
52
52
  Symbol#to_s: f
53
53
  Symbol#size: 1
54
54
  Symbol#encoding: !ruby/encoding US-ASCII
55
- Value: Fixnum 3
55
+ Value: Integer 3