rpr 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +107 -5
  3. data/exe/rpr +1 -1
  4. data/lib/rpr/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ac562c662f0a475149e0a7f2fe4020b23d4f34b
4
- data.tar.gz: dea660b67361a7e67bf22d363e4400e7c493d7cf
3
+ metadata.gz: 4b3bd66aafe96f60138763e1de04392bf2bb1af4
4
+ data.tar.gz: d1e3bf9dca2ec71377d03d6699aed9929c6253aa
5
5
  SHA512:
6
- metadata.gz: 6c2df3a08f33b9a12fd5401133b98c79b761f2213cbe46349343c8ed0a517a6e5dca82b3625f1c46ec11ad4e475a622e2758ed990ab1557429c69eda10505ca7
7
- data.tar.gz: 2e97cff95744cfdeafe30e79d24153ee150488665dbd2cc77fb3fa763ed4cfdbf31ce8eaf6494a6b12dfcc5c42f30e8161ad1662afd7e9702b47f809e38eb22e
6
+ metadata.gz: 7a15d846e10d073b4390ed355c8f840afbbd94a022646e136a3bd003cd344e5f0497041f226d7efb5e78d0a685957bd919c5c7f907aa91993d7b7554d33b7fe5
7
+ data.tar.gz: 51a3464320dd2f1754c3feda7ed5fb5fc712a314dd9008c5ea45445620fe55842e3d62ea0f8ffd6ddb9141f437a1715993ae794395bc14196768c5a61f75e4f0
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Rpr
1
+ # RPR
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rpr`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Command line :heart: [Ripper](http://ruby-doc.org/stdlib-2.3.0/libdoc/ripper/rdoc/Ripper.html).
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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/[USERNAME]/rpr.
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', '--version=VAL'){|v| OPT[:method] = v}
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)
@@ -1,3 +1,3 @@
1
1
  module Rpr
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
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.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-18 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry