debugging 1.0.2 → 1.1.0
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 +4 -4
- data/.travis.yml +17 -7
- data/{ChangeLog.rdoc → ChangeLog.md} +17 -3
- data/Gemfile +0 -4
- data/LICENSE.txt +1 -1
- data/README.md +173 -0
- data/debugging.gemspec +5 -3
- data/lib/debugging/howtocall.rb +34 -0
- data/lib/debugging/mof.rb +13 -12
- data/lib/debugging/q.rb +1 -1
- data/lib/debugging/version.rb +1 -1
- data/spec/howtocall_spec.rb +93 -0
- data/spec/q_spec.rb +10 -8
- metadata +37 -36
- data/README.rdoc +0 -123
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bd2a1941fbb803028c072531f8d3963f0d019fd
|
4
|
+
data.tar.gz: 2b1de46d5030b634e773a44582a89790d4dbe87d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8987a8faefde09b1e0723f4fbe0d684accc284174f3936054564b1b5462c37f2df6fbb04051b6ce8dc34203853f5972026a24b7e05b867d68dcc79f7b8f954
|
7
|
+
data.tar.gz: 7b8032e6afc0c7af066df97765a60546f49d396316994bd1fc32227ed90bf5ab739fad5c0240c1440b730e9c61e1679f2678626ac3662845734d5e34294d33f6
|
data/.travis.yml
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
+
sudo: false
|
1
2
|
language: ruby
|
2
3
|
|
3
4
|
rvm:
|
4
5
|
- ruby-head
|
5
|
-
- 2.2
|
6
|
-
- 2.1
|
7
|
-
- 2.0
|
8
|
-
-
|
9
|
-
- jruby
|
10
|
-
- jruby-
|
11
|
-
|
6
|
+
- 2.2
|
7
|
+
- 2.1
|
8
|
+
- 2.0
|
9
|
+
- rbx-2
|
10
|
+
- jruby-head
|
11
|
+
- jruby-9000
|
12
|
+
|
13
|
+
env:
|
14
|
+
- JRUBY_OPTS="--2.1"
|
15
|
+
|
16
|
+
cache:
|
17
|
+
- bundler
|
18
|
+
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: rbx-2
|
12
22
|
|
13
23
|
bundler_args: --without full_support
|
@@ -1,27 +1,41 @@
|
|
1
|
-
|
1
|
+
## ChangeLog
|
2
|
+
|
3
|
+
### 1.1.0 / 2015-03-26
|
4
|
+
|
5
|
+
* Added:
|
6
|
+
* howtocall
|
7
|
+
* Change output from `mof`, now only returns singleton methods per module for modules
|
8
|
+
* Make q compatible with paint ~> 1.0
|
9
|
+
* Drop support for Ruby 1
|
10
|
+
|
11
|
+
|
12
|
+
### 1.0.2 / 2015-01-24
|
2
13
|
|
3
14
|
* Bump binding.repl version
|
4
15
|
|
5
16
|
|
6
|
-
|
17
|
+
### 1.0.1 / 2014-02-15
|
7
18
|
|
8
19
|
* Bump binding.repl version
|
9
20
|
|
10
21
|
|
11
|
-
|
22
|
+
### 1.0.0 / 2014-01-19
|
12
23
|
|
13
24
|
* Adjusted concept: Only helper method style
|
14
25
|
* Removed:
|
15
26
|
* dd
|
16
27
|
* binding.vars
|
28
|
+
|
17
29
|
* Added:
|
18
30
|
* beep
|
19
31
|
* repl
|
32
|
+
|
20
33
|
* Renamed:
|
21
34
|
* oo -> at
|
22
35
|
* cc -> callstack
|
23
36
|
* mm -> mof
|
24
37
|
* regexp_visualize -> re
|
38
|
+
|
25
39
|
* Method List: Display all available ancestors by default and add third argument for grepping
|
26
40
|
* Moved from zucker 13.1 gem into its own gem
|
27
41
|
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
# Ruby Print Debugging [](https://badge.fury.io/rb/debugging) [<img src="https://travis-ci.org/janlelis/debugging.png" />](https://travis-ci.org/janlelis/debugging)
|
2
|
+
|
3
|
+
Helps you to introspect and debug your code.
|
4
|
+
|
5
|
+
|
6
|
+
## Setup
|
7
|
+
|
8
|
+
Install gem:
|
9
|
+
|
10
|
+
```
|
11
|
+
$ gem install debugging binding_of_caller
|
12
|
+
```
|
13
|
+
|
14
|
+
|
15
|
+
In Ruby:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'debugging/all'
|
19
|
+
```
|
20
|
+
|
21
|
+
Instead of requiring all, you can also require only one function, e.g:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'debugging/q'
|
25
|
+
```
|
26
|
+
|
27
|
+
In a bundler project, you will need to add the gem to your project's `Gemfile`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'debugging', require: 'debugging/all'
|
31
|
+
gem 'binding_of_caller'
|
32
|
+
```
|
33
|
+
|
34
|
+
## Methods
|
35
|
+
### at(label = nil)
|
36
|
+
|
37
|
+
Prints out that a specific point in a script has been reached.
|
38
|
+
|
39
|
+
```
|
40
|
+
[label] @ method `...', line ... of file ....
|
41
|
+
```
|
42
|
+
|
43
|
+
### beep
|
44
|
+
|
45
|
+
Lets your terminal bell ring.
|
46
|
+
|
47
|
+
### callstack
|
48
|
+
|
49
|
+
Prints out your current callstack. For example:
|
50
|
+
|
51
|
+
```
|
52
|
+
<main>
|
53
|
+
start
|
54
|
+
catch
|
55
|
+
block in start
|
56
|
+
eval_input
|
57
|
+
each_top_level_statement
|
58
|
+
catch
|
59
|
+
block in each_top_level_statement
|
60
|
+
loop
|
61
|
+
block (2 levels) in each_top_level_statement
|
62
|
+
block in eval_input
|
63
|
+
signal_status
|
64
|
+
block (2 levels) in eval_input
|
65
|
+
evaluate
|
66
|
+
evaluate
|
67
|
+
eval
|
68
|
+
irb_binding
|
69
|
+
```
|
70
|
+
|
71
|
+
### howtocall(obj = self, method_or_proc)
|
72
|
+
|
73
|
+
Displays parameter names and types for a proc or method (identified by a symbol):
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
def function(a, b = 3, &c)
|
77
|
+
end
|
78
|
+
howtocall :function #=> function(a, b, &c)
|
79
|
+
```
|
80
|
+
|
81
|
+
What is not visible in the example above: All optional parameters are displayed underlined.
|
82
|
+
|
83
|
+
If you want to access a function that is defined on an other object than the current one,
|
84
|
+
you can pass it as an optional parameter:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
howtocall FileUtils, :cd #=> cd(dir, options, &block)
|
88
|
+
howtocall Open3, :popen3 #=> popen3(*cmd, **opts, &block)
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
An example with lambdas and keyword arguments:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
a = ->(filter: /\A.*\z/, string:){ string[filter] }
|
96
|
+
howtocall a #=> call(string:, filter:)
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
### mof(obj, depth = nil)
|
101
|
+
|
102
|
+
"Methods of": Prints out available methods, ordered by modules:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
mof [1,2,3]
|
106
|
+
```
|
107
|
+
|
108
|
+
```
|
109
|
+
###
|
110
|
+
Eigenclass
|
111
|
+
|
112
|
+
Array
|
113
|
+
inspect to_s to_a to_h to_ary frozen? == eql? hash [] []= at fet
|
114
|
+
ch first last concat << push pop shift unshift insert each each_i
|
115
|
+
ndex reverse_each length size empty? find_index index rindex join r
|
116
|
+
everse reverse! rotate rotate! sort sort! sort_by! collect collect!
|
117
|
+
map map! select select! keep_if values_at delete delete_at delete_i
|
118
|
+
f reject reject! zip transpose replace clear fill include? <=> sli
|
119
|
+
ce slice! assoc rassoc + * - & | uniq uniq! compact compact! fl
|
120
|
+
atten flatten! count shuffle! shuffle sample cycle permutation combi
|
121
|
+
nation repeated_permutation repeated_combination product take take_whil
|
122
|
+
e drop drop_while bsearch pack
|
123
|
+
|
124
|
+
Enumerable
|
125
|
+
to_a entries to_h sort sort_by grep count find detect find_index f
|
126
|
+
ind_all select reject collect map flat_map collect_concat inject red
|
127
|
+
uce partition group_by first all? any? one? none? min max minmax
|
128
|
+
min_by max_by minmax_by member? include? each_with_index reverse_each
|
129
|
+
each_entry each_slice each_cons each_with_object zip take take_while
|
130
|
+
drop drop_while cycle chunk slice_before lazy
|
131
|
+
|
132
|
+
Object
|
133
|
+
|
134
|
+
Debugging
|
135
|
+
|
136
|
+
Kernel
|
137
|
+
nil? === =~ !~ eql? hash <=> class singleton_class clone dup tain
|
138
|
+
t tainted? untaint untrust untrusted? trust freeze frozen? to_s ins
|
139
|
+
pect methods singleton_methods protected_methods private_methods public
|
140
|
+
_methods instance_variables instance_variable_get instance_variable_set
|
141
|
+
instance_variable_defined? remove_instance_variable instance_of? kind_of?
|
142
|
+
is_a? tap send public_send respond_to? extend display method publi
|
143
|
+
c_method singleton_method define_singleton_method object_id to_enum enu
|
144
|
+
m_for
|
145
|
+
|
146
|
+
BasicObject
|
147
|
+
== equal? ! != instance_eval instance_exec __send__ __id__
|
148
|
+
```
|
149
|
+
|
150
|
+
### q(*args)
|
151
|
+
|
152
|
+
Like `Kernel#p`, but with colors on one line:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
q :is_like, ?p, "but on one line"
|
156
|
+
```
|
157
|
+
|
158
|
+
### re(string, regex, groups = nil)
|
159
|
+
|
160
|
+
Assists you when matching regexes againts strings. Try this one:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
re "mail@janlelis.de", /\b([A-Z0-9._%+-]+)@([A-Z0-9.-]+\.[A-Z]{2,10})\b/i, 0..2
|
164
|
+
```
|
165
|
+
|
166
|
+
### repl
|
167
|
+
|
168
|
+
Starts your favorite IRB session from the current binding.
|
169
|
+
|
170
|
+
## J-_-L
|
171
|
+
|
172
|
+
Copyright (c) 2010-2015 Jan Lelis. MIT License. Originated from the
|
173
|
+
[zucker](http://rubyzucker.info) gem.
|
data/debugging.gemspec
CHANGED
@@ -12,13 +12,15 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.email = "mail@janlelis.de"
|
13
13
|
gem.homepage = "https://github.com/janlelis/debugging"
|
14
14
|
|
15
|
-
gem.files = Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
|
15
|
+
gem.files = Dir['{**/}{.*,*}'].select { |path| File.file?(path) && path !~ /pkg/ }
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.
|
21
|
-
|
20
|
+
gem.required_ruby_version = '~> 2.0'
|
21
|
+
|
22
|
+
gem.add_dependency 'paint', '>= 0.9', '< 2.0'
|
23
|
+
gem.add_dependency 'binding.repl', '~> 3.0'
|
22
24
|
|
23
25
|
gem.add_development_dependency 'bundler', '~> 1.0'
|
24
26
|
gem.add_development_dependency 'rake', '~> 10.1'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'debugging'
|
2
|
+
|
3
|
+
module Debugging
|
4
|
+
def howtocall(object = self, method_or_proc)
|
5
|
+
if method_or_proc.is_a? Proc
|
6
|
+
params = method_or_proc.parameters
|
7
|
+
template = "call(%s)"
|
8
|
+
else
|
9
|
+
unless method_or_proc.is_a?(Method) || method_or_proc.is_a?(UnboundMethod)
|
10
|
+
method_or_proc = object.method(method_or_proc)
|
11
|
+
end
|
12
|
+
params = method_or_proc.parameters
|
13
|
+
template = "#{method_or_proc.name}(%s)"
|
14
|
+
end
|
15
|
+
|
16
|
+
sig = params.map{ |type, name|
|
17
|
+
param = ""
|
18
|
+
param << "*" if type == :rest
|
19
|
+
param << "**" if type == :keyrest
|
20
|
+
param << "&" if type == :block
|
21
|
+
name = ?? if !name && !(type == :rest || type == :keyrest)
|
22
|
+
if type == :opt || type == :key
|
23
|
+
param << Paint[name, :underline]
|
24
|
+
else
|
25
|
+
param << name.to_s
|
26
|
+
end
|
27
|
+
param << ":" if type == :key || type == :keyreq
|
28
|
+
param
|
29
|
+
}*", "
|
30
|
+
|
31
|
+
puts template %(sig)
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
end
|
data/lib/debugging/mof.rb
CHANGED
@@ -3,27 +3,28 @@ require 'debugging'
|
|
3
3
|
module Debugging
|
4
4
|
private
|
5
5
|
|
6
|
-
def mof(obj, depth = nil,
|
7
|
-
|
6
|
+
def mof(obj, depth = nil, grep = //)
|
7
|
+
grep = Regexp.new(grep)
|
8
8
|
puts Paint["###", :red, :bold]
|
9
9
|
|
10
|
-
eigen_methods = obj.singleton_methods.grep(grep_for)
|
11
|
-
if eigen_methods.empty?
|
12
|
-
puts Paint['Eigenclass', :yellow]
|
13
|
-
else
|
14
|
-
puts Paint['Eigenclass', :green, :underline], eigen_methods.map(&:to_s)*' '
|
15
|
-
end
|
16
|
-
puts
|
17
|
-
|
18
10
|
if obj.is_a? Module
|
19
|
-
klass, method_function = obj, :
|
11
|
+
klass, method_function = obj, :singleton_methods
|
12
|
+
depth += 1 if depth
|
20
13
|
else
|
21
14
|
klass, method_function = obj.class, :public_instance_methods
|
15
|
+
|
16
|
+
eigen_methods = obj.singleton_methods.grep(grep)
|
17
|
+
if eigen_methods.empty?
|
18
|
+
puts Paint['Eigenclass', :yellow]
|
19
|
+
else
|
20
|
+
puts Paint['Eigenclass', :green, :underline], eigen_methods.map(&:to_s)*' '
|
21
|
+
end
|
22
|
+
puts
|
22
23
|
end
|
23
24
|
|
24
25
|
(depth || klass.ancestors.size).times{ |level|
|
25
26
|
if cur = klass.ancestors[level]
|
26
|
-
level_methods = cur.send(method_function, false).grep(
|
27
|
+
level_methods = cur.send(method_function, false).grep(grep)
|
27
28
|
colors = level_methods.empty? ? [:yellow] : [:green, :underline]
|
28
29
|
puts Paint["#{cur}", *colors], level_methods.map(&:to_s)*' '
|
29
30
|
puts unless level_methods.empty?
|
data/lib/debugging/q.rb
CHANGED
data/lib/debugging/version.rb
CHANGED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'debugging/howtocall'
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
|
8
|
+
describe "howtocall" do
|
9
|
+
it "displays method parameters" do
|
10
|
+
def function(a, b)
|
11
|
+
end
|
12
|
+
|
13
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(a, b)\n"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "underlines optional parameters" do
|
17
|
+
def function(a, b = 3)
|
18
|
+
end
|
19
|
+
|
20
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(a, \e[4mb\e[0m)\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "shows block parameters" do
|
24
|
+
def function(a, &b)
|
25
|
+
end
|
26
|
+
|
27
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(a, &b)\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "optionally takes an object where the method shoud be looked for (if not self)" do
|
31
|
+
module Klass
|
32
|
+
def self.function(a,b)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
expect( capture_stdout{ howtocall Klass, :function } ).to eq "function(a, b)\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "appends : for keyword arguments" do
|
40
|
+
def function(a: 42, b: 43)
|
41
|
+
end
|
42
|
+
|
43
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(\e[4ma\e[0m:, \e[4mb\e[0m:)\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "shows *splats and keyword **splats" do
|
47
|
+
def function(*cmd, **opts)
|
48
|
+
end
|
49
|
+
|
50
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(*cmd, **opts)\n"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "shows ? for array deconstructor parameters" do
|
54
|
+
def function((a, b))
|
55
|
+
end
|
56
|
+
|
57
|
+
expect( capture_stdout{ howtocall :function } ).to eq "function(?)\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "also works for procs" do
|
61
|
+
lambda = ->(a, b){}
|
62
|
+
|
63
|
+
expect( capture_stdout{ howtocall lambda } ).to eq "call(a, b)\n"
|
64
|
+
end
|
65
|
+
|
66
|
+
if RUBY_ENGINE == "ruby" || RUBY_ENGINE == "jruby"
|
67
|
+
context "[native methods]" do
|
68
|
+
it "shows ? instead of parameter names for fixed amount of parameters" do
|
69
|
+
expect( capture_stdout{ howtocall :is_a? } ).to eq "is_a?(?)\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "shows * instead of parameters for variable amount of parameters" do
|
73
|
+
expect( capture_stdout{ howtocall :puts } ).to eq "puts(*)\n"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
__END__
|
81
|
+
```ruby
|
82
|
+
howtocall FileUtils, :cd #=> cd(dir, options, &block)
|
83
|
+
howtocall Open3, :popen3 #=> popen3(*cmd, **opts, &block)
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
An example with lambdas and keyword arguments:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
a = ->(filter: /\A.*\z/, string:){ string[filter] }
|
91
|
+
howtocall a #=> call(string:, filter:)
|
92
|
+
|
93
|
+
|
data/spec/q_spec.rb
CHANGED
@@ -2,18 +2,20 @@ require 'spec_helper'
|
|
2
2
|
require 'debugging/q'
|
3
3
|
|
4
4
|
describe 'q' do
|
5
|
-
it
|
6
|
-
|
7
|
-
|
5
|
+
it "should output the same as p for a single arg" do
|
6
|
+
expect(
|
7
|
+
Paint.unpaint(capture_stdout{q /some object/})
|
8
|
+
).to eq capture_stdout{p /some object/}
|
8
9
|
end
|
9
10
|
|
10
11
|
it "should output the same as p but for multiple args one one line, values separated by two spaces" do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
expect(
|
13
|
+
Paint.unpaint(capture_stdout{
|
14
|
+
q 1, "1", 2..5, [], {:hallo => :du}, nil, true
|
15
|
+
}
|
16
|
+
).chop ).to eq capture_stdout{
|
15
17
|
p 1, "1", 2..5, [], {:hallo => :du}, nil, true
|
16
|
-
|
18
|
+
}.chop.gsub( "\n", ' ' )
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
metadata
CHANGED
@@ -1,117 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debugging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paint
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
- -
|
19
|
+
version: '0.9'
|
20
|
+
- - <
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0
|
22
|
+
version: '2.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- -
|
29
|
+
version: '0.9'
|
30
|
+
- - <
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0
|
32
|
+
version: '2.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: binding.repl
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '3'
|
39
|
+
version: '3.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '3'
|
46
|
+
version: '3.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '1.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '10.1'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '10.1'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rdoc
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '3.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '3.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '2.4'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '2.4'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rubygems-tasks
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0.2'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ~>
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0.2'
|
117
117
|
description: Provides useful print debugging helpers.
|
@@ -120,15 +120,15 @@ executables: []
|
|
120
120
|
extensions: []
|
121
121
|
extra_rdoc_files: []
|
122
122
|
files:
|
123
|
-
-
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
- ChangeLog.
|
123
|
+
- .editorconfig
|
124
|
+
- .gitignore
|
125
|
+
- .rspec
|
126
|
+
- .travis.yml
|
127
|
+
- ChangeLog.md
|
128
128
|
- Gemfile
|
129
129
|
- Gemfile.lock
|
130
130
|
- LICENSE.txt
|
131
|
-
- README.
|
131
|
+
- README.md
|
132
132
|
- Rakefile
|
133
133
|
- debugging.gemspec
|
134
134
|
- lib/debugging.rb
|
@@ -136,13 +136,13 @@ files:
|
|
136
136
|
- lib/debugging/at.rb
|
137
137
|
- lib/debugging/beep.rb
|
138
138
|
- lib/debugging/callstack.rb
|
139
|
+
- lib/debugging/howtocall.rb
|
139
140
|
- lib/debugging/mof.rb
|
140
141
|
- lib/debugging/q.rb
|
141
142
|
- lib/debugging/re.rb
|
142
143
|
- lib/debugging/repl.rb
|
143
144
|
- lib/debugging/version.rb
|
144
|
-
-
|
145
|
-
- pkg/debugging-1.0.1.gem
|
145
|
+
- spec/howtocall_spec.rb
|
146
146
|
- spec/q_spec.rb
|
147
147
|
- spec/re_spec.rb
|
148
148
|
- spec/spec_helper.rb
|
@@ -156,21 +156,22 @@ require_paths:
|
|
156
156
|
- lib
|
157
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ~>
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: '0'
|
161
|
+
version: '2.0'
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.4.
|
169
|
+
rubygems_version: 2.4.3
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Print debugging helpers.
|
173
173
|
test_files:
|
174
|
+
- spec/howtocall_spec.rb
|
174
175
|
- spec/q_spec.rb
|
175
176
|
- spec/re_spec.rb
|
176
177
|
- spec/spec_helper.rb
|
data/README.rdoc
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
= Ruby Print Debugging {<img src="https://travis-ci.org/janlelis/debugging.png" />}[https://travis-ci.org/janlelis/debugging]
|
2
|
-
|
3
|
-
|
4
|
-
== Setup
|
5
|
-
|
6
|
-
$ gem install debugging binding_of_caller
|
7
|
-
|
8
|
-
|
9
|
-
Or in your Gemfile:
|
10
|
-
|
11
|
-
gem 'debugging', require: 'debugging/all'
|
12
|
-
gem 'binding_of_caller'
|
13
|
-
|
14
|
-
|
15
|
-
In Ruby:
|
16
|
-
|
17
|
-
require 'debugging/all'
|
18
|
-
|
19
|
-
|
20
|
-
== Methods
|
21
|
-
|
22
|
-
=== at(label = nil)
|
23
|
-
|
24
|
-
[label] @ method `...', line ... of file ....
|
25
|
-
|
26
|
-
|
27
|
-
=== beep
|
28
|
-
|
29
|
-
Lets your terminal bell ring.
|
30
|
-
|
31
|
-
|
32
|
-
=== callstack
|
33
|
-
|
34
|
-
<main>
|
35
|
-
start
|
36
|
-
catch
|
37
|
-
block in start
|
38
|
-
eval_input
|
39
|
-
each_top_level_statement
|
40
|
-
catch
|
41
|
-
block in each_top_level_statement
|
42
|
-
loop
|
43
|
-
block (2 levels) in each_top_level_statement
|
44
|
-
block in eval_input
|
45
|
-
signal_status
|
46
|
-
block (2 levels) in eval_input
|
47
|
-
evaluate
|
48
|
-
evaluate
|
49
|
-
eval
|
50
|
-
irb_binding
|
51
|
-
|
52
|
-
|
53
|
-
=== mof(obj, depth = nil)
|
54
|
-
|
55
|
-
"methods of:"
|
56
|
-
|
57
|
-
>> mof [1,2,3]
|
58
|
-
###
|
59
|
-
Eigenclass
|
60
|
-
|
61
|
-
Array
|
62
|
-
inspect to_s to_a to_h to_ary frozen? == eql? hash [] []= at fet
|
63
|
-
ch first last concat << push pop shift unshift insert each each_i
|
64
|
-
ndex reverse_each length size empty? find_index index rindex join r
|
65
|
-
everse reverse! rotate rotate! sort sort! sort_by! collect collect!
|
66
|
-
map map! select select! keep_if values_at delete delete_at delete_i
|
67
|
-
f reject reject! zip transpose replace clear fill include? <=> sli
|
68
|
-
ce slice! assoc rassoc + * - & | uniq uniq! compact compact! fl
|
69
|
-
atten flatten! count shuffle! shuffle sample cycle permutation combi
|
70
|
-
nation repeated_permutation repeated_combination product take take_whil
|
71
|
-
e drop drop_while bsearch pack
|
72
|
-
|
73
|
-
Enumerable
|
74
|
-
to_a entries to_h sort sort_by grep count find detect find_index f
|
75
|
-
ind_all select reject collect map flat_map collect_concat inject red
|
76
|
-
uce partition group_by first all? any? one? none? min max minmax
|
77
|
-
min_by max_by minmax_by member? include? each_with_index reverse_each
|
78
|
-
each_entry each_slice each_cons each_with_object zip take take_while
|
79
|
-
drop drop_while cycle chunk slice_before lazy
|
80
|
-
|
81
|
-
Object
|
82
|
-
|
83
|
-
Debugging
|
84
|
-
|
85
|
-
Kernel
|
86
|
-
nil? === =~ !~ eql? hash <=> class singleton_class clone dup tain
|
87
|
-
t tainted? untaint untrust untrusted? trust freeze frozen? to_s ins
|
88
|
-
pect methods singleton_methods protected_methods private_methods public
|
89
|
-
_methods instance_variables instance_variable_get instance_variable_set
|
90
|
-
instance_variable_defined? remove_instance_variable instance_of? kind_of?
|
91
|
-
is_a? tap send public_send respond_to? extend display method publi
|
92
|
-
c_method singleton_method define_singleton_method object_id to_enum enu
|
93
|
-
m_for
|
94
|
-
|
95
|
-
BasicObject
|
96
|
-
== equal? ! != instance_eval instance_exec __send__ __id__
|
97
|
-
|
98
|
-
|
99
|
-
=== q(*args)
|
100
|
-
|
101
|
-
q :is_like, ?p, "but on one line"
|
102
|
-
|
103
|
-
|
104
|
-
=== re(string, regex, groups = nil)
|
105
|
-
|
106
|
-
Assists you when matching regexes againts strings. Try this one:
|
107
|
-
|
108
|
-
re "mail@janlelis.de", /\b([A-Z0-9._%+-]+)@([A-Z0-9.-]+\.[A-Z]{2,10})\b/i, 0..2
|
109
|
-
|
110
|
-
|
111
|
-
=== repl
|
112
|
-
|
113
|
-
Starts your favorite IRB session.
|
114
|
-
|
115
|
-
|
116
|
-
== Also See
|
117
|
-
|
118
|
-
https://github.com/davejacobs/letters
|
119
|
-
|
120
|
-
|
121
|
-
== J-_-L
|
122
|
-
|
123
|
-
Copyright (c) 2010-2015 Jan Lelis. MIT License. Originated from the {zucker}[http://rubyzucker.info] gem.
|