pd 1.0.1 → 1.0.2
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.
- data/README.md +22 -8
- data/lib/pd.rb +8 -16
- data/version.rb +1 -1
- metadata +12 -4
data/README.md
CHANGED
@@ -9,26 +9,40 @@ pd, a print helper method for debug to Kernel
|
|
9
9
|
|
10
10
|
Overview
|
11
11
|
--------
|
12
|
-
|
12
|
+
sometimes, I need debug other people's code, and I'd like to use `pd`, so add this lib to environment variable `RUBYOPT="-r pd"` make this happen.
|
13
|
+
|
14
|
+
pd(print debug), for debug only, like p, but use ", " between each argument as separator instead of "\n".
|
13
15
|
|
14
16
|
* search 'pd' is much easier than 'p' in source file.
|
15
17
|
* sometimes use pd is much convient than p
|
16
18
|
|
17
19
|
For example:
|
20
|
+
|
21
|
+
pd :Person, name, age
|
22
|
+
#=>
|
23
|
+
Person: "Alice", 12
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
"
|
22
|
-
|
23
|
-
pd a, a.length
|
24
|
-
"foo" 3
|
25
|
+
p name, age
|
26
|
+
#=>
|
27
|
+
"Alice"
|
28
|
+
12
|
25
29
|
|
26
30
|
Usage
|
27
31
|
-----
|
28
32
|
|
29
|
-
add RUBYOPT
|
33
|
+
add RUBYOPT as Environment Variable
|
34
|
+
RUBYOPT="-r pd" # for ruby1.9
|
35
|
+
RUBYOPT="-r/absolute/path/to/pd" # for ruby1.8
|
30
36
|
pd "a","b"
|
31
37
|
|
38
|
+
Contributing
|
39
|
+
-------------
|
40
|
+
|
41
|
+
* report bugs/featues to issue tracker.
|
42
|
+
* fork it and pull a request.
|
43
|
+
* improve documentation.
|
44
|
+
* feel free to post any ideas.
|
45
|
+
|
32
46
|
Install
|
33
47
|
----------
|
34
48
|
|
data/lib/pd.rb
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
module Kernel
|
2
|
-
#
|
3
|
-
# * search 'pd' is much easier than 'p' in source file.
|
4
|
-
# * sometimes use pd is much convient than p
|
2
|
+
# print for debug
|
5
3
|
#
|
6
|
-
# @
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# =>
|
10
|
-
# "foo"
|
11
|
-
# 3
|
12
|
-
# pd a, a.length
|
13
|
-
# =>
|
14
|
-
# "foo" 3
|
4
|
+
# @overlaod pd(obj, ...)
|
5
|
+
# @param [Symbol]
|
6
|
+
#
|
15
7
|
#
|
16
|
-
# @
|
17
|
-
#
|
8
|
+
# @overload pd(title, obj, ...)
|
9
|
+
# @param [Symbol] title if first arg is a Captial Symbol, use it as title
|
10
|
+
# @return [nil]
|
18
11
|
def pd *args
|
19
|
-
args.
|
20
|
-
print "\n"
|
12
|
+
puts args.map{|v|v.inspect}.join(", ")
|
21
13
|
end
|
22
14
|
|
23
15
|
# *for debug* print hr. puts '='*14 + " #{name}"
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Guten
|
@@ -10,7 +14,7 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-
|
17
|
+
date: 2011-06-08 00:00:00 +08:00
|
14
18
|
default_executable:
|
15
19
|
dependencies: []
|
16
20
|
|
@@ -50,17 +54,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
54
|
requirements:
|
51
55
|
- - ">="
|
52
56
|
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
53
59
|
version: "0"
|
54
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
61
|
none: false
|
56
62
|
requirements:
|
57
63
|
- - ">="
|
58
64
|
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
59
67
|
version: "0"
|
60
68
|
requirements: []
|
61
69
|
|
62
70
|
rubyforge_project: xx
|
63
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.3.7
|
64
72
|
signing_key:
|
65
73
|
specification_version: 3
|
66
74
|
summary: a print helper method for debug to Kernel
|