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.
Files changed (4) hide show
  1. data/README.md +22 -8
  2. data/lib/pd.rb +8 -16
  3. data/version.rb +1 -1
  4. 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
- pd(print debug), for debug only, like p, but use " " between each argument as separator instead of "\n".
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
- a="foo"
20
- p a, a.length
21
- "foo"
22
- 3
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="-r pd" as environment variable.
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
- # *for debug* pd(print debug), like p, but use " " in each argument instead of "\n".
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
- # @example
7
- # a="foo"
8
- # p a, a.length
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
- # @param [Object] *args
17
- # @return nil
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.each do |arg| print arg.inspect," " end
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
@@ -1,7 +1,7 @@
1
1
  module VERSION
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- PATCH = 1
4
+ PATCH = 2
5
5
 
6
6
  IS = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
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
- version: 1.0.1
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-03-06 00:00:00 +08:00
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.6.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