irb-power_assert 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +52 -9
- data/lib/irb/power_assert/version.rb +1 -1
- metadata +13 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0dbfb61c05a160571994b6eef963d802e42109a093f220aea2bdcb8ce911c67
|
4
|
+
data.tar.gz: d23d682c50cc32db7a3bb6636d53f4a3c48ff9ccd115010bcd2e7d358f625216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c360c1cb5dc4c50366f338cfede19617a07367e98c6a3c8b9ef7b74213c4166ca179c16643d4cfd497aac758ce4845dc59ae085a9f03755059a052340d3a04
|
7
|
+
data.tar.gz: fc6fade10b30dc2081db6dbff82dc4c56dbf208c6215c6699fc9795d38de191381b8cbf31d69499414616d2e142f4cc278044104b3cdccf496e1e7d48d131610
|
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
## Overview
|
7
7
|
|
8
|
-
![screenshot](https://user-images.githubusercontent.com/1180335/
|
8
|
+
![screenshot - expression](https://user-images.githubusercontent.com/1180335/119386011-efc1bb00-bd01-11eb-80c4-1aea86fa3781.png)
|
9
9
|
|
10
10
|
[ruby/power_assert](https://github.com/ruby/power_assert) is a recent My favorites. (the author is [@k-tsj](https://github.com/k-tsj), thank you!)
|
11
11
|
|
@@ -19,7 +19,7 @@ Honor should be bestowed upon them.
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
Require Ruby 2.
|
22
|
+
Require Ruby 2.6 or later
|
23
23
|
|
24
24
|
This command will install the latest version into your environment
|
25
25
|
|
@@ -39,18 +39,12 @@ Or specify in your `~/.irbrc` as below
|
|
39
39
|
require 'irb/power_assert'
|
40
40
|
```
|
41
41
|
|
42
|
-
Or
|
43
|
-
|
44
|
-
```ruby
|
45
|
-
require 'irb-power_assert'
|
46
|
-
```
|
47
|
-
|
48
42
|
```console
|
49
43
|
$ irb
|
50
44
|
# Then enabled this gem!
|
51
45
|
```
|
52
46
|
|
53
|
-
|
47
|
+
Then you can use `pa` as an IRB command.
|
54
48
|
|
55
49
|
```ruby
|
56
50
|
irb(main):001:0> pa %q{ "0".class == "3".to_i.times.map {|i| i + 1 }.class }
|
@@ -67,6 +61,55 @@ result: false
|
|
67
61
|
=> nil
|
68
62
|
```
|
69
63
|
|
64
|
+
So you can see, the `pa` just takes strings of the code.
|
65
|
+
|
66
|
+
If you want to directly pass `expression`, below is the hack for single line code.
|
67
|
+
|
68
|
+
Write below code in your `~/.irbrc`
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
# This logic taken from following reference, @k0kubun thank you!
|
72
|
+
# * https://github.com/k0kubun/dotfiles/blob/8762ee623adae0fba20ed0a5ef7c8ff5825dc20a/config/.irbrc#L241-L262
|
73
|
+
# * https://k0kubun.hatenablog.com/entry/2021/04/02/211455
|
74
|
+
IRB::Context.prepend(Module.new{
|
75
|
+
kwargs = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0') ? ', **' : ''
|
76
|
+
line = __LINE__; eval %q{
|
77
|
+
def evaluate(line, *__ARGS__)
|
78
|
+
case line
|
79
|
+
when /\Apa /
|
80
|
+
line.replace("pa #{line.sub(/\Apa +/, '').strip.dump}\n")
|
81
|
+
end
|
82
|
+
super
|
83
|
+
end
|
84
|
+
}.sub(/__ARGS__/, kwargs), nil, __FILE__, line
|
85
|
+
})
|
86
|
+
```
|
87
|
+
|
88
|
+
Then you can use the `pa` as below...
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
irb(main):001:0> pa "0".class == "3".to_i.times.map {|i| i + 1 }.class
|
92
|
+
result: false
|
93
|
+
|
94
|
+
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
95
|
+
| | | | | |
|
96
|
+
| | | | | Array
|
97
|
+
| | | | [1, 2, 3]
|
98
|
+
| | | #<Enumerator: ...>
|
99
|
+
| | 3
|
100
|
+
| false
|
101
|
+
String
|
102
|
+
=> nil
|
103
|
+
```
|
104
|
+
|
105
|
+
This repository has the example [.irbrc](examples/.irbrc), if you don't have the file yet, trying it may be fun.
|
106
|
+
|
107
|
+
```shell
|
108
|
+
gem install irb-power_assert
|
109
|
+
wget 'https://raw.githubusercontent.com/kachick/irb-power_assert/main/examples/.irbrc' -P "$HOME"
|
110
|
+
irb
|
111
|
+
```
|
112
|
+
|
70
113
|
## References
|
71
114
|
|
72
115
|
* [power-assert-js/power-assert](https://github.com/power-assert-js/power-assert)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb-power_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Kamiya
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.4.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.4.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2.0'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 2.0.
|
39
|
+
version: 2.0.1
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '3.0'
|
@@ -46,132 +46,10 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 2.0.
|
49
|
+
version: 2.0.1
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3.0'
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: test-unit
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 3.4.1
|
60
|
-
- - "<"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '4.0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 3.4.1
|
70
|
-
- - "<"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '4.0'
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: warning
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 1.2.0
|
80
|
-
- - "<"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.0'
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.2.0
|
90
|
-
- - "<"
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '2.0'
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: rake
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 13.0.3
|
100
|
-
- - "<"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '20.0'
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 13.0.3
|
110
|
-
- - "<"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '20.0'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: rubocop
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - ">="
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: 1.14.0
|
120
|
-
- - "<"
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 1.15.0
|
123
|
-
type: :development
|
124
|
-
prerelease: false
|
125
|
-
version_requirements: !ruby/object:Gem::Requirement
|
126
|
-
requirements:
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: 1.14.0
|
130
|
-
- - "<"
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 1.15.0
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: rubocop-rake
|
135
|
-
requirement: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
type: :development
|
141
|
-
prerelease: false
|
142
|
-
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
- !ruby/object:Gem::Dependency
|
148
|
-
name: rubocop-performance
|
149
|
-
requirement: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
|
-
type: :development
|
155
|
-
prerelease: false
|
156
|
-
version_requirements: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '0'
|
161
|
-
- !ruby/object:Gem::Dependency
|
162
|
-
name: rubocop-rubycw
|
163
|
-
requirement: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
|
-
type: :development
|
169
|
-
prerelease: false
|
170
|
-
version_requirements: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
53
|
description: power_assert in irb
|
176
54
|
email:
|
177
55
|
- kachick1+ruby@gmail.com
|
@@ -179,7 +57,7 @@ executables: []
|
|
179
57
|
extensions: []
|
180
58
|
extra_rdoc_files: []
|
181
59
|
files:
|
182
|
-
- LICENSE
|
60
|
+
- LICENSE.txt
|
183
61
|
- README.md
|
184
62
|
- lib/irb-power_assert.rb
|
185
63
|
- lib/irb/cmd/pa.rb
|
@@ -191,7 +69,8 @@ licenses:
|
|
191
69
|
metadata:
|
192
70
|
homepage_uri: https://github.com/kachick/irb-power_assert
|
193
71
|
source_code_uri: https://github.com/kachick/irb-power_assert
|
194
|
-
|
72
|
+
rubygems_mfa_required: 'true'
|
73
|
+
post_install_message:
|
195
74
|
rdoc_options: []
|
196
75
|
require_paths:
|
197
76
|
- lib
|
@@ -199,15 +78,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
78
|
requirements:
|
200
79
|
- - ">="
|
201
80
|
- !ruby/object:Gem::Version
|
202
|
-
version: 2.
|
81
|
+
version: 2.6.0
|
203
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
83
|
requirements:
|
205
84
|
- - ">="
|
206
85
|
- !ruby/object:Gem::Version
|
207
86
|
version: '0'
|
208
87
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
210
|
-
signing_key:
|
88
|
+
rubygems_version: 3.3.7
|
89
|
+
signing_key:
|
211
90
|
specification_version: 4
|
212
91
|
summary: power_assert in irb
|
213
92
|
test_files: []
|