rpr 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +107 -5
- data/exe/rpr +1 -1
- data/lib/rpr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b3bd66aafe96f60138763e1de04392bf2bb1af4
|
4
|
+
data.tar.gz: d1e3bf9dca2ec71377d03d6699aed9929c6253aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a15d846e10d073b4390ed355c8f840afbbd94a022646e136a3bd003cd344e5f0497041f226d7efb5e78d0a685957bd919c5c7f907aa91993d7b7554d33b7fe5
|
7
|
+
data.tar.gz: 51a3464320dd2f1754c3feda7ed5fb5fc712a314dd9008c5ea45445620fe55842e3d62ea0f8ffd6ddb9141f437a1715993ae794395bc14196768c5a61f75e4f0
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# RPR
|
2
2
|
|
3
|
-
|
3
|
+
Command line :heart: [Ripper](http://ruby-doc.org/stdlib-2.3.0/libdoc/ripper/rdoc/Ripper.html).
|
4
4
|
|
5
|
-
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/rpr.svg)](https://badge.fury.io/rb/rpr)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,109 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Basic Usage
|
26
|
+
|
27
|
+
```sh
|
28
|
+
$ echo 'puts "Hello world"' > hello.rb
|
29
|
+
$ rpr hello.rb
|
30
|
+
[:program,
|
31
|
+
[[:command,
|
32
|
+
[:@ident, "puts", [1, 0]],
|
33
|
+
[:args_add_block,
|
34
|
+
[[:string_literal,
|
35
|
+
[:string_content, [:@tstring_content, "Hello world", [1, 6]]]]],
|
36
|
+
false]]]]
|
37
|
+
```
|
38
|
+
|
39
|
+
### Specify Method
|
40
|
+
|
41
|
+
Default: `sexp`
|
42
|
+
|
43
|
+
```sh
|
44
|
+
$ rpr hello.rb --method sexp_raw
|
45
|
+
[:program,
|
46
|
+
[:stmts_add,
|
47
|
+
[:stmts_new],
|
48
|
+
[:command,
|
49
|
+
[:@ident, "puts", [1, 0]],
|
50
|
+
[:args_add_block,
|
51
|
+
[:args_add,
|
52
|
+
[:args_new],
|
53
|
+
[:string_literal,
|
54
|
+
[:string_add,
|
55
|
+
[:string_content],
|
56
|
+
[:@tstring_content, "Hello world", [1, 6]]]]],
|
57
|
+
false]]]]
|
58
|
+
```
|
59
|
+
|
60
|
+
```sh
|
61
|
+
$ rpr hello.rb --method tokenize
|
62
|
+
["puts", " ", "\"", "Hello world", "\"", "\n"]
|
63
|
+
```
|
64
|
+
|
65
|
+
### Specify output formatter
|
66
|
+
|
67
|
+
Default: `pp`
|
68
|
+
|
69
|
+
```sh
|
70
|
+
$ rpr hello.rb --formatter json
|
71
|
+
[
|
72
|
+
"program",
|
73
|
+
[
|
74
|
+
[
|
75
|
+
"command",
|
76
|
+
[
|
77
|
+
"@ident",
|
78
|
+
"puts",
|
79
|
+
[
|
80
|
+
1,
|
81
|
+
0
|
82
|
+
]
|
83
|
+
],
|
84
|
+
[
|
85
|
+
"args_add_block",
|
86
|
+
[
|
87
|
+
[
|
88
|
+
"string_literal",
|
89
|
+
[
|
90
|
+
"string_content",
|
91
|
+
[
|
92
|
+
"@tstring_content",
|
93
|
+
"Hello world",
|
94
|
+
[
|
95
|
+
1,
|
96
|
+
6
|
97
|
+
]
|
98
|
+
]
|
99
|
+
]
|
100
|
+
]
|
101
|
+
],
|
102
|
+
false
|
103
|
+
]
|
104
|
+
]
|
105
|
+
]
|
106
|
+
]
|
107
|
+
```
|
108
|
+
|
109
|
+
Inspect AST with [pry](https://github.com/pry/pry).
|
110
|
+
|
111
|
+
```sh
|
112
|
+
$ rpr hello.rb --formatter pry
|
113
|
+
[1] pry(#<Array>)> self
|
114
|
+
=> [:program, [[:command, [:@ident, "puts", [1, 0]], [:args_add_block, [[:string_literal, [:string_content, [:@tstring_content, "Hello world", [1, 6]]]]], false]]]]
|
115
|
+
[2] pry(#<Array>)> ls
|
116
|
+
Enumerable#methods:
|
117
|
+
all? chunk_while detect each_entry each_with_index entries find_all grep group_by lazy max_by min minmax none? partition slice_after slice_when
|
118
|
+
chunk collect_concat each_cons each_slice each_with_object find flat_map grep_v inject max member? min_by minmax_by one? reduce slice_before sort_by
|
119
|
+
Array#methods:
|
120
|
+
& << []= bsearch collect! concat delete_at drop_while eql? first hash inspect length permutation product reject! reverse rotate select! shuffle! sort take_while to_s unshift
|
121
|
+
* <=> any? bsearch_index combination count delete_if each fetch flatten include? join map pop push repeated_combination reverse! rotate! shelljoin size sort! to_a transpose values_at
|
122
|
+
+ == assoc clear compact cycle dig each_index fill flatten! index keep_if map! pretty_print rassoc repeated_permutation reverse_each sample shift slice sort_by! to_ary uniq zip
|
123
|
+
- [] at collect compact! delete drop empty? find_index frozen? insert last pack pretty_print_cycle reject replace rindex select shuffle slice! take to_h uniq! |
|
124
|
+
self.methods: __pry__
|
125
|
+
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_
|
126
|
+
[3] pry(#<Array>)> exit
|
127
|
+
```
|
26
128
|
|
27
129
|
## Development
|
28
130
|
|
@@ -32,5 +134,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
134
|
|
33
135
|
## Contributing
|
34
136
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
137
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/rpr.
|
36
138
|
|
data/exe/rpr
CHANGED
@@ -12,7 +12,7 @@ OPT = {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
opt.on('-f=VAL', '--formatter=VAL'){|v| OPT[:formatter] = v.to_sym}
|
15
|
-
opt.on('-m=VAL', '--
|
15
|
+
opt.on('-m=VAL', '--method=VAL'){|v| OPT[:method] = v}
|
16
16
|
opt.on('-v', '--version'){|v| OPT[:version] = v}
|
17
17
|
|
18
18
|
opt.parse!(ARGV)
|
data/lib/rpr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|