irb-power_assert 0.0.2 → 0.1.0
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 +53 -10
- data/lib/irb/power_assert/version.rb +1 -1
- metadata +15 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 527bbd045ba6df2be55749ae8f04b571103b8ce8b86e69b9cdc40f4c1968f461
|
4
|
+
data.tar.gz: 83ab0a1bc1e2dc065ee75c42cc5e1878ab8e406e98ae28bb20596fa9ade0f579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec87c56e9bbf5e58ba1ec8a08fbd18ebacb877f202ba7e3c3112d00c4453b5a84aebcab0c424afe7b6d3de01c9ba4da1aea190d36288dcba8631179ad8c4534
|
7
|
+
data.tar.gz: 6a7008d7509e30b7754d5cdcdbf4b867e58c67055c1720fe62daca4deeae897232def645441a6d47ddbcd509c755dbb30f324638b39071d54adb2ac55fef1e59
|
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# irb-power_assert
|
2
2
|
|
3
3
|
![Build Status](https://github.com/kachick/irb-power_assert/actions/workflows/test.yml/badge.svg?branch=main)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/irb-power_assert.
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/irb-power_assert.svg)](http://badge.fury.io/rb/irb-power_assert)
|
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.7 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.1.0
|
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-12-25 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
|
@@ -189,9 +67,12 @@ homepage: https://github.com/kachick/irb-power_assert
|
|
189
67
|
licenses:
|
190
68
|
- MIT
|
191
69
|
metadata:
|
70
|
+
documentation_uri: https://kachick.github.io/irb-power_assert/
|
192
71
|
homepage_uri: https://github.com/kachick/irb-power_assert
|
193
72
|
source_code_uri: https://github.com/kachick/irb-power_assert
|
194
|
-
|
73
|
+
bug_tracker_uri: https://github.com/kachick/irb-power_assert/issues
|
74
|
+
rubygems_mfa_required: 'true'
|
75
|
+
post_install_message:
|
195
76
|
rdoc_options: []
|
196
77
|
require_paths:
|
197
78
|
- lib
|
@@ -199,15 +80,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
80
|
requirements:
|
200
81
|
- - ">="
|
201
82
|
- !ruby/object:Gem::Version
|
202
|
-
version: 2.
|
83
|
+
version: '2.7'
|
203
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
85
|
requirements:
|
205
86
|
- - ">="
|
206
87
|
- !ruby/object:Gem::Version
|
207
88
|
version: '0'
|
208
89
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
210
|
-
signing_key:
|
90
|
+
rubygems_version: 3.4.1
|
91
|
+
signing_key:
|
211
92
|
specification_version: 4
|
212
93
|
summary: power_assert in irb
|
213
94
|
test_files: []
|