debug_me 1.0.2 → 1.0.3
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 +7 -0
- data/README.md +40 -0
- data/debug_me.gemspec +2 -2
- data/lib/debug_me.rb +13 -13
- data/lib/debug_me/version.rb +1 -1
- metadata +20 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9b580ce21e94329c161f88ed59b1ab4253ebcced2342f5b53bb8f19331165b9e
|
4
|
+
data.tar.gz: c61d2b6b1071199a06cb9db9034893da11de869e1f8b1110c9406ab1ace17f13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 579fba5c98c8fe2445b02982aa6ec4c975dff81c21b40d20204f69d8e2ce0be7f084df878d8551a3fa1222a61b0597fd900d81a2d284ff97140a14dd3cdc7ecc
|
7
|
+
data.tar.gz: 62190a395d1207487b61d30184fc5d8420d9b539caa8f4213cf8544d69df2a20a6a6d1fc4c964f54f11b9f6930599c34d4bc79da2ea91cf33649fbc20dc05439
|
data/README.md
CHANGED
@@ -59,6 +59,46 @@ debug_me(:ivar => false, :cvar => false) {} # print only the local variables wit
|
|
59
59
|
|
60
60
|
```
|
61
61
|
|
62
|
+
## Default Options
|
63
|
+
|
64
|
+
The default options are maintained in a global constant `DebugMeDefaultOptions` that is outside of the `DebugMe` name space. I did that so that if you do `include DebugMe` to make access to the method eaier you could still have the constant with a function specific name that would be outside of anything that you may have already coded in you program.
|
65
|
+
|
66
|
+
```
|
67
|
+
DebugMeDefaultOptions = {
|
68
|
+
tag: 'DEBUG:', # A tag to prepend to each output line
|
69
|
+
time: true, # Include a time-stamp in front of the tag
|
70
|
+
header: true, # Print a header string before printing the variables
|
71
|
+
lvar: true, # Include local variables
|
72
|
+
ivar: true, # Include instance variables in the output
|
73
|
+
cvar: true, # Include class variables in the output
|
74
|
+
cconst: true, # Include class constants
|
75
|
+
file: $stdout # The output file
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
If you want the output of the method to always got to STDERR then do this:
|
80
|
+
|
81
|
+
```
|
82
|
+
require 'debug_me'
|
83
|
+
DebugMeDefaultOptions[:file] = $stderr
|
84
|
+
```
|
85
|
+
If you want the `debug_me` output to go to a real file:
|
86
|
+
|
87
|
+
```
|
88
|
+
DebugMeDefaultOptions[:file] = File.open('debug_me.log', 'w')
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
The rest of the default options are obvious.
|
93
|
+
|
94
|
+
You can always over-ride the default options on a case by case basis like this:
|
95
|
+
|
96
|
+
```
|
97
|
+
debug_me {...}
|
98
|
+
...
|
99
|
+
debug_me(header: false){...}
|
100
|
+
```
|
101
|
+
|
62
102
|
## Contributing
|
63
103
|
|
64
104
|
1. Fork it ( https://github.com/[my-github-username]/debug_me/fork )
|
data/debug_me.gemspec
CHANGED
@@ -21,6 +21,6 @@ time after time. I guess that marks me as a geezer.'
|
|
21
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
25
|
-
spec.add_development_dependency 'rake'
|
24
|
+
spec.add_development_dependency 'bundler'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
26
|
end
|
data/lib/debug_me.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
require 'pp'
|
2
2
|
require_relative 'debug_me/version'
|
3
3
|
|
4
|
+
DebugMeDefaultOptions = {
|
5
|
+
tag: 'DEBUG:', # A tag to prepend to each output line
|
6
|
+
time: true, # Include a time-stamp in front of the tag
|
7
|
+
header: true, # Print a header string before printing the variables
|
8
|
+
lvar: true, # Include local variables
|
9
|
+
ivar: true, # Include instance variables in the output
|
10
|
+
cvar: true, # Include class variables in the output
|
11
|
+
cconst: true, # Include class constants
|
12
|
+
file: $stdout # The output file
|
13
|
+
}
|
14
|
+
|
4
15
|
module DebugMe
|
5
16
|
def debug_me(options = {}, &block)
|
6
|
-
default_options = {
|
7
|
-
tag: 'DEBUG:', # A tag to prepend to each output line
|
8
|
-
time: true, # Include a time-stamp in front of the tag
|
9
|
-
header: true, # Print a header string before printing the variables
|
10
|
-
lvar: true, # Include local variables
|
11
|
-
ivar: true, # Include instance variables in the output
|
12
|
-
cvar: true, # Include class variables in the output
|
13
|
-
cconst: true, # Include class constants
|
14
|
-
file: $stdout # The output file
|
15
|
-
}
|
16
|
-
|
17
17
|
|
18
18
|
if 'Hash' == options.class.to_s
|
19
|
-
options =
|
19
|
+
options = DebugMeDefaultOptions.merge(options)
|
20
20
|
else
|
21
|
-
options =
|
21
|
+
options = DebugMeDefaultOptions.merge(tag: options)
|
22
22
|
end
|
23
23
|
|
24
24
|
out_string = ''
|
data/lib/debug_me/version.rb
CHANGED
metadata
CHANGED
@@ -1,63 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debug_me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dewayne VanHoozer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-03-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
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
|
-
version: '
|
26
|
+
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
33
|
+
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
46
|
-
description:
|
47
|
-
|
40
|
+
version: '0'
|
41
|
+
description: |-
|
42
|
+
This thing is pretty old. There are much better
|
48
43
|
ways of debugging in a complex application. But,
|
49
|
-
|
50
44
|
you know, I keep returning to this little method
|
51
|
-
|
52
|
-
time after time. I guess that marks me as a geezer.'
|
45
|
+
time after time. I guess that marks me as a geezer.
|
53
46
|
email:
|
54
47
|
- dvanhoozer@gmail.com
|
55
48
|
executables: []
|
56
49
|
extensions: []
|
57
50
|
extra_rdoc_files: []
|
58
51
|
files:
|
59
|
-
- .gitignore
|
60
|
-
- .rultor.yml
|
52
|
+
- ".gitignore"
|
53
|
+
- ".rultor.yml"
|
61
54
|
- Gemfile
|
62
55
|
- LICENSE.txt
|
63
56
|
- README.md
|
@@ -71,26 +64,25 @@ files:
|
|
71
64
|
homepage: http://github.com/MadBomber/debug_me
|
72
65
|
licenses:
|
73
66
|
- You want it, its yours
|
67
|
+
metadata: {}
|
74
68
|
post_install_message:
|
75
69
|
rdoc_options: []
|
76
70
|
require_paths:
|
77
71
|
- lib
|
78
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
73
|
requirements:
|
81
|
-
- -
|
74
|
+
- - ">="
|
82
75
|
- !ruby/object:Gem::Version
|
83
76
|
version: '0'
|
84
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
78
|
requirements:
|
87
|
-
- -
|
79
|
+
- - ">="
|
88
80
|
- !ruby/object:Gem::Version
|
89
81
|
version: '0'
|
90
82
|
requirements: []
|
91
83
|
rubyforge_project:
|
92
|
-
rubygems_version:
|
84
|
+
rubygems_version: 2.7.6
|
93
85
|
signing_key:
|
94
|
-
specification_version:
|
86
|
+
specification_version: 4
|
95
87
|
summary: A tool to print the labeled value of variables.
|
96
88
|
test_files: []
|