clean_ripper 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/clean_ripper.rb +1 -1
- data/lib/clean_ripper_doc.rb +13 -2
- data/lib/clean_sexp_builder.rb +1 -1
- data/test/clean_ripper_test.rb +16 -16
- metadata +3 -4
data/lib/clean_ripper.rb
CHANGED
data/lib/clean_ripper_doc.rb
CHANGED
@@ -16,7 +16,7 @@ class CleanRipperDocumentation
|
|
16
16
|
# A binary operation.
|
17
17
|
# @example
|
18
18
|
# 1+2 #=> [:binary, [:lit, 1], :+, [:lit, 2]]
|
19
|
-
# a and b #=> [:binary, [lvar, :a], :and, [:lvar, :a]]
|
19
|
+
# a and b #=> [:binary, [:lvar, :a], :and, [:lvar, :a]]
|
20
20
|
# @param [Sexp] right The right side of the operation.
|
21
21
|
# @param [Sexp] left The left side of the operation.
|
22
22
|
# @param [Symbol] operator The operator.
|
@@ -24,7 +24,7 @@ class CleanRipperDocumentation
|
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
|
-
#
|
27
|
+
# An unary operation.
|
28
28
|
# @example
|
29
29
|
# -a #=> [:unary, :-, [:lvar, :a]]
|
30
30
|
# !b #=> [:unary, :!, [:lvar, :b]]
|
@@ -48,4 +48,15 @@ class CleanRipperDocumentation
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
+
# An interpolated string.
|
52
|
+
# @example
|
53
|
+
# "teste: #{var}"
|
54
|
+
# #=> [:string, [:lit, "teste: "], [:lvar, :var]]
|
55
|
+
# "a#{2}b"
|
56
|
+
# #=> [:string, [:lit, "a"], [:lit, 2], [:lit, "b"]]
|
57
|
+
# @param [Sexp] parts All parts of the string.
|
58
|
+
def string(*parts)
|
59
|
+
|
60
|
+
end
|
61
|
+
|
51
62
|
end
|
data/lib/clean_sexp_builder.rb
CHANGED
data/test/clean_ripper_test.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
require 'test/unit'
|
3
|
-
require '
|
3
|
+
require 'clean_ripper'
|
4
4
|
|
5
5
|
class CleanRipperTest < Test::Unit::TestCase
|
6
6
|
|
7
7
|
def test_001
|
8
|
-
code = <<-END
|
8
|
+
code = <<-'END'
|
9
9
|
(12 + 65) * 3
|
10
10
|
END
|
11
11
|
|
@@ -47,7 +47,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
47
47
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
48
48
|
end
|
49
49
|
def test_002
|
50
|
-
code = <<-END
|
50
|
+
code = <<-'END'
|
51
51
|
--2
|
52
52
|
END
|
53
53
|
|
@@ -77,7 +77,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
77
77
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
78
78
|
end
|
79
79
|
def test_003
|
80
|
-
code = <<-END
|
80
|
+
code = <<-'END'
|
81
81
|
-2**-3
|
82
82
|
END
|
83
83
|
|
@@ -115,7 +115,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
115
115
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
116
116
|
end
|
117
117
|
def test_004
|
118
|
-
code = <<-END
|
118
|
+
code = <<-'END'
|
119
119
|
true ? 2 : 3 ? 4 : 5
|
120
120
|
END
|
121
121
|
|
@@ -152,7 +152,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
152
152
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
153
153
|
end
|
154
154
|
def test_005
|
155
|
-
code = <<-END
|
155
|
+
code = <<-'END'
|
156
156
|
a = oops rescue 10
|
157
157
|
END
|
158
158
|
|
@@ -187,7 +187,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
187
187
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
188
188
|
end
|
189
189
|
def test_006
|
190
|
-
code = <<-END
|
190
|
+
code = <<-'END'
|
191
191
|
a = nil
|
192
192
|
b = 1 + 2
|
193
193
|
END
|
@@ -224,7 +224,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
224
224
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
225
225
|
end
|
226
226
|
def test_007
|
227
|
-
code = <<-END
|
227
|
+
code = <<-'END'
|
228
228
|
a = *()
|
229
229
|
b = *[1, 2, 3]
|
230
230
|
END
|
@@ -286,7 +286,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
286
286
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
287
287
|
end
|
288
288
|
def test_008
|
289
|
-
code = <<-END
|
289
|
+
code = <<-'END'
|
290
290
|
a = b = 2
|
291
291
|
a += 5
|
292
292
|
END
|
@@ -328,7 +328,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
328
328
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
329
329
|
end
|
330
330
|
def test_009
|
331
|
-
code = <<-END
|
331
|
+
code = <<-'END'
|
332
332
|
!!10
|
333
333
|
a || b and c
|
334
334
|
END
|
@@ -371,7 +371,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
371
371
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
372
372
|
end
|
373
373
|
def test_010
|
374
|
-
code = <<-END
|
374
|
+
code = <<-'END'
|
375
375
|
if true
|
376
376
|
true while true or false
|
377
377
|
end
|
@@ -417,7 +417,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
417
417
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
418
418
|
end
|
419
419
|
def test_011
|
420
|
-
code = <<-END
|
420
|
+
code = <<-'END'
|
421
421
|
a,b = 1,2
|
422
422
|
END
|
423
423
|
|
@@ -458,7 +458,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
458
458
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
459
459
|
end
|
460
460
|
def test_012
|
461
|
-
code = <<-END
|
461
|
+
code = <<-'END'
|
462
462
|
begin
|
463
463
|
a
|
464
464
|
rescue
|
@@ -518,7 +518,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
518
518
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
519
519
|
end
|
520
520
|
def test_013
|
521
|
-
code = <<-END
|
521
|
+
code = <<-'END'
|
522
522
|
print var
|
523
523
|
print(var)
|
524
524
|
print (var)
|
@@ -580,7 +580,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
580
580
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
581
581
|
end
|
582
582
|
def test_014
|
583
|
-
code = <<-END
|
583
|
+
code = <<-'END'
|
584
584
|
Array.new(5, nil)
|
585
585
|
END
|
586
586
|
|
@@ -619,7 +619,7 @@ class CleanRipperTest < Test::Unit::TestCase
|
|
619
619
|
assert_equal(ripper, Ripper::SexpBuilder.new(code).parse)
|
620
620
|
end
|
621
621
|
def test_015
|
622
|
-
code = <<-END
|
622
|
+
code = <<-'END'
|
623
623
|
eval do
|
624
624
|
print "Hello World!"
|
625
625
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clean_ripper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-11 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Produces a clean output for Ripper, making the output tree usable and
|
15
15
|
readable.
|
@@ -42,10 +42,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 1.
|
45
|
+
rubygems_version: 1.8.10
|
46
46
|
signing_key:
|
47
47
|
specification_version: 3
|
48
48
|
summary: Produces a clean output for Ripper.
|
49
49
|
test_files:
|
50
50
|
- test/clean_ripper_test.rb
|
51
|
-
has_rdoc:
|