pryx 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +45 -3
- data/lib/pryx/version.rb +1 -1
- data/lib/pryx.rb +5 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c877bb193222c2d2540f95eea205253844c0e9c874d3f6a75235c42fcaef704
|
4
|
+
data.tar.gz: fec0feb940e81d862287bbd1a9e957fa2f6ae7247fe632da3c1eaf5354e96435
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a1d57e969a8500268a5b13817de9fb90a0ab4a355f3a17af28fb83b1d1e0ad22369365b5d3377e77e14e931f96a2582fa4ff63bac5e77e581b1cab42f61eeb4
|
7
|
+
data.tar.gz: bb70d8c676aeb5ee72f449e63e598deeff24415ad08a677d1beb007bcce16a1059fa703e735fff9e89f253be672641b4e1b2a3b147c8e5c350ad2967b3b151d3
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Three Virtues of a Programmer: Laziness, Impatience, and Hubris. -- Larry Wall,
|
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
|
7
|
+
[NOTICE] Check [What's new in Ruby 3.2's IRB?](https://st0012.dev/whats-new-in-ruby-3-2-irb) for the introduced new feature of Ruby 3.2 IRB which includes part of feature this gem provides.
|
8
|
+
|
7
9
|
Don't add this gem into bundler's Gemfile.
|
8
10
|
|
9
11
|
Instead, install it directly via RubyGems
|
@@ -14,12 +16,54 @@ Then user can use pryx cross all your's project.
|
|
14
16
|
|
15
17
|
## Usage
|
16
18
|
|
19
|
+
At first, it is just pry, with more extensions.
|
20
|
+
|
21
|
+
you can always run it with `pryx`.
|
22
|
+
|
23
|
+
```sh
|
24
|
+
╰─ $ pryx
|
25
|
+
[1] pry(main)> ? Array#each_with_object
|
26
|
+
|
27
|
+
From: enum.c (C Method):
|
28
|
+
Owner: Enumerable
|
29
|
+
Visibility: public
|
30
|
+
Signature: each_with_object(arg1)
|
31
|
+
Number of lines: 20
|
32
|
+
|
33
|
+
Calls the block once for each element, passing both the element
|
34
|
+
and the given object:
|
35
|
+
|
36
|
+
(1..4).each_with_object([]) {|i, a| a.push(i**2) }
|
37
|
+
# => [1, 4, 9, 16]
|
38
|
+
|
39
|
+
{foo: 0, bar: 1, baz: 2}.each_with_object({}) {|(k, v), h| h[v] = k }
|
40
|
+
# => {0=>:foo, 1=>:bar, 2=>:baz}
|
41
|
+
|
42
|
+
With no block given, returns an Enumerator.
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
enum_each_with_object(VALUE obj, VALUE memo)
|
46
|
+
{
|
47
|
+
RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enum_size);
|
48
|
+
|
49
|
+
rb_block_call(obj, id_each, 0, 0, each_with_object_i, memo);
|
50
|
+
|
51
|
+
return memo;
|
52
|
+
}
|
53
|
+
[2] pry(main)>
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
Second, it add a new `Kernel#pry!`, you can use it instead of `binding.pry`.
|
58
|
+
It's not just an alias, there are more.
|
59
|
+
|
17
60
|
Before use it, you need set `RUBYOPT` variable.
|
18
61
|
|
19
62
|
You can do this two way in a terminal.
|
20
63
|
|
21
64
|
```sh
|
22
|
-
$: export RUBYOPT+=' -rpryx'
|
65
|
+
$: export RUBYOPT+=' -rpryx' # For BASH only
|
66
|
+
$: export RUBYOPT="$RUBYOPT -rpryx" # For others shell
|
23
67
|
$: ruby your_file.rb # add pry! in your_file for start pry session
|
24
68
|
|
25
69
|
```
|
@@ -31,8 +75,6 @@ or Run your's code directly use:
|
|
31
75
|
$: RUBYOPT+='-rpryx' ruby your_file.rb # add pry! in your_file for start pry session
|
32
76
|
```
|
33
77
|
|
34
|
-
Then, try add `pry!` into your's ruby code, then run it, have fun!
|
35
|
-
|
36
78
|
Following is a example, assume there is a `test.rb` with content:
|
37
79
|
|
38
80
|
```rb
|
data/lib/pryx/version.rb
CHANGED
data/lib/pryx.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pryx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Billy.Zheng(zw963)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '1.
|
145
|
+
version: '1.6'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '1.
|
152
|
+
version: '1.6'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pry-stack_explorer
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
- !ruby/object:Gem::Version
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.4.6
|
271
271
|
signing_key:
|
272
272
|
specification_version: 4
|
273
273
|
summary: pry extension tools!
|