ruby-beautify 0.97.3 → 0.97.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -0
- data/WHATSNEW.md +3 -0
- data/lib/ruby-beautify.rb +1 -1
- data/lib/ruby-beautify/version.rb +1 -1
- data/spec/usage_scenarios/lambda_literal.rb +34 -0
- data/spec/usage_scenarios/lambda_literal_pretty.rb +34 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e145f753ca12d248bd82a07ee04b6b136a8b859
|
4
|
+
data.tar.gz: 04bd621ab8f28ad8662c0ab2ca2b9571bfbd5d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43bf99c41b289337b0088ebdc120b2d521353b455ef064369dba06f8adc2b49c0cddb070df9c82a69d8c0748a10345f053f893e92102160f3528c7649d5adf08
|
7
|
+
data.tar.gz: d6ac375f0f07acbeeccf606473075e0f01fe3bf1929d023817452cf6c429a381aa0d6d465a72acedaae91ed9d4b8096290bcbf5590540254641c6d6bbdffc3c3
|
data/Rakefile
CHANGED
@@ -1,2 +1,20 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
desc "Generate a new usage scenario."
|
5
|
+
task :generate_usage_scenario, [:scenario] do |task, args|
|
6
|
+
unless args[:scenario]
|
7
|
+
puts "must define a scenario"
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
files = ["#{args[:scenario]}.rb","#{args[:scenario]}_pretty.rb"]
|
11
|
+
files.each do |f|
|
12
|
+
f = "spec/usage_scenarios/#{f}"
|
13
|
+
if File.exist? f
|
14
|
+
puts " skipping #{f}"
|
15
|
+
else
|
16
|
+
puts " generating #{f}"
|
17
|
+
FileUtils.touch f
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/WHATSNEW.md
CHANGED
data/lib/ruby-beautify.rb
CHANGED
@@ -10,7 +10,7 @@ module RubyBeautify
|
|
10
10
|
OPEN_BLOCK_DO = ['do', '{']
|
11
11
|
CLOSE_BLOCK = ['end', '}']
|
12
12
|
|
13
|
-
OPEN_BRACKETS = [:on_lparen, :on_lbracket, :on_lbrace, :on_embexpr_beg]
|
13
|
+
OPEN_BRACKETS = [:on_lparen, :on_lbracket, :on_lbrace, :on_embexpr_beg, :on_tlambeg]
|
14
14
|
CLOSE_BRACKETS = [:on_rparen, :on_rbracket, :on_rbrace, :on_embexpr_end]
|
15
15
|
NEW_LINES = [:on_nl, :on_ignored_nl, :on_comment, :on_embdoc_end]
|
16
16
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Test for lambda literal
|
2
|
+
class ArrowOperator
|
3
|
+
def one_liner
|
4
|
+
x = -> (x) {x * x}
|
5
|
+
end
|
6
|
+
def one_liner2args
|
7
|
+
x = -> (x, y) {x * y}
|
8
|
+
end
|
9
|
+
def multiline
|
10
|
+
x = -> (x) {
|
11
|
+
x * x
|
12
|
+
}
|
13
|
+
end
|
14
|
+
def multiline2args
|
15
|
+
x = -> (x, y) {
|
16
|
+
x * y
|
17
|
+
}
|
18
|
+
end
|
19
|
+
def omit_braces
|
20
|
+
x = -> x {
|
21
|
+
x * x
|
22
|
+
}
|
23
|
+
end
|
24
|
+
def omit_braces2args
|
25
|
+
x = -> x, y {
|
26
|
+
x * y
|
27
|
+
}
|
28
|
+
end
|
29
|
+
def argument_nothing
|
30
|
+
x = -> {
|
31
|
+
x * x
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Test for lambda literal
|
2
|
+
class ArrowOperator
|
3
|
+
def one_liner
|
4
|
+
x = -> (x) {x * x}
|
5
|
+
end
|
6
|
+
def one_liner2args
|
7
|
+
x = -> (x, y) {x * y}
|
8
|
+
end
|
9
|
+
def multiline
|
10
|
+
x = -> (x) {
|
11
|
+
x * x
|
12
|
+
}
|
13
|
+
end
|
14
|
+
def multiline2args
|
15
|
+
x = -> (x, y) {
|
16
|
+
x * y
|
17
|
+
}
|
18
|
+
end
|
19
|
+
def omit_braces
|
20
|
+
x = -> x {
|
21
|
+
x * x
|
22
|
+
}
|
23
|
+
end
|
24
|
+
def omit_braces2args
|
25
|
+
x = -> x, y {
|
26
|
+
x * y
|
27
|
+
}
|
28
|
+
end
|
29
|
+
def argument_nothing
|
30
|
+
x = -> {
|
31
|
+
x * x
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-beautify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.97.
|
4
|
+
version: 0.97.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Brodeur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -92,6 +92,8 @@ files:
|
|
92
92
|
- spec/usage_scenarios/case_pretty.rb
|
93
93
|
- spec/usage_scenarios/from_control.rb
|
94
94
|
- spec/usage_scenarios/from_control_pretty.rb
|
95
|
+
- spec/usage_scenarios/lambda_literal.rb
|
96
|
+
- spec/usage_scenarios/lambda_literal_pretty.rb
|
95
97
|
- spec/usage_scenarios/monolithic_example.rb
|
96
98
|
- spec/usage_scenarios/monolithic_example_pretty.rb
|
97
99
|
- spec/usage_scenarios/multiline_strings.rb
|
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
version: '0'
|
124
126
|
requirements: []
|
125
127
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.4.8
|
127
129
|
signing_key:
|
128
130
|
specification_version: 4
|
129
131
|
summary: a cli tool (and module) to beautify ruby code.
|
@@ -145,6 +147,8 @@ test_files:
|
|
145
147
|
- spec/usage_scenarios/case_pretty.rb
|
146
148
|
- spec/usage_scenarios/from_control.rb
|
147
149
|
- spec/usage_scenarios/from_control_pretty.rb
|
150
|
+
- spec/usage_scenarios/lambda_literal.rb
|
151
|
+
- spec/usage_scenarios/lambda_literal_pretty.rb
|
148
152
|
- spec/usage_scenarios/monolithic_example.rb
|
149
153
|
- spec/usage_scenarios/monolithic_example_pretty.rb
|
150
154
|
- spec/usage_scenarios/multiline_strings.rb
|
@@ -157,3 +161,4 @@ test_files:
|
|
157
161
|
- spec/usage_scenarios/pre_indented_pretty.rb
|
158
162
|
- spec/usage_scenarios/pre_indented_pretty_space.rb
|
159
163
|
- spec/usage_scenarios_spec.rb
|
164
|
+
has_rdoc:
|