ruby2ruby 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,14 @@
1
+ === 2.0.3 / 2013-02-07
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * 1.9: Added support for ! call to go back to (not ...).
6
+ * 2nd and 3rd order testing now uses RubyPraser.for_current_ruby for maximal carnage.
7
+
8
+ * 1 bug fix:
9
+
10
+ * On failure (eg ruby 2.0), fall back to compound RubyParser instance for 2nd & 3rd order testing
11
+
1
12
  === 2.0.2 / 2013-01-16
2
13
 
3
14
  * 1 minor enhancement:
@@ -24,7 +24,7 @@ class Regexp
24
24
  end
25
25
 
26
26
  class Ruby2Ruby < SexpProcessor
27
- VERSION = '2.0.2'
27
+ VERSION = '2.0.3'
28
28
  LINE_LENGTH = 78
29
29
 
30
30
  BINARY = [:<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :**]
@@ -229,6 +229,8 @@ class Ruby2Ruby < SexpProcessor
229
229
  receiver ||= "self"
230
230
  rhs = args.pop
231
231
  "#{receiver}[#{args.join(', ')}] = #{rhs}"
232
+ when :"!" then
233
+ "(not #{receiver})"
232
234
  when :"-@" then
233
235
  "-#{receiver}"
234
236
  when :"+@" then
@@ -350,6 +350,21 @@ class TestRuby2Ruby < R2RTestCase
350
350
  util_compare inn, out
351
351
  end
352
352
 
353
+ def test_unless_vs_if_not
354
+ rb1 = "a unless b"
355
+ rb2 = "a if (not b)"
356
+ rb3 = "a if ! b"
357
+
358
+ util_compare Ruby18Parser.new.parse(rb1), rb1
359
+ util_compare Ruby19Parser.new.parse(rb1), rb1
360
+
361
+ util_compare Ruby18Parser.new.parse(rb2), rb1
362
+ util_compare Ruby19Parser.new.parse(rb2), rb2
363
+
364
+ util_compare Ruby18Parser.new.parse(rb3), rb1
365
+ util_compare Ruby19Parser.new.parse(rb3), rb2
366
+ end
367
+
353
368
  def util_compare sexp, expected_ruby, expected_eval = nil
354
369
  assert_equal expected_ruby, @processor.process(sexp)
355
370
  assert_equal expected_eval, eval(expected_ruby) if expected_eval
@@ -384,7 +399,8 @@ def silent_eval ruby
384
399
  end
385
400
 
386
401
  def morph_and_eval src, from, to, processor
387
- new_src = processor.new.process(Ruby18Parser.new.process(src.sub(from, to)))
402
+ parser = RubyParser.for_current_ruby rescue RubyParser.new
403
+ new_src = processor.new.process(parser.process(src.sub(from, to)))
388
404
 
389
405
  silent_eval new_src
390
406
  new_src
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 2
10
- version: 2.0.2
9
+ - 3
10
+ version: 2.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-01-17 00:00:00 Z
39
+ date: 2013-02-07 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sexp_processor
@@ -76,11 +76,11 @@ dependencies:
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- hash: 19
79
+ hash: 17
80
80
  segments:
81
81
  - 4
82
- - 4
83
- version: "4.4"
82
+ - 5
83
+ version: "4.5"
84
84
  type: :development
85
85
  version_requirements: *id003
86
86
  - !ruby/object:Gem::Dependency
@@ -106,11 +106,11 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- hash: 15
109
+ hash: 13
110
110
  segments:
111
111
  - 3
112
- - 4
113
- version: "3.4"
112
+ - 5
113
+ version: "3.5"
114
114
  type: :development
115
115
  version_requirements: *id005
116
116
  description: |-
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  requirements: []
168
168
 
169
169
  rubyforge_project: seattlerb
170
- rubygems_version: 1.8.24
170
+ rubygems_version: 1.8.25
171
171
  signing_key:
172
172
  specification_version: 3
173
173
  summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser compatible Sexps
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ċ��Rp��iPf��5]�-�{4��"Hr(
2
- {ߤJ��TMw㉜h��$i�F�@�������K��$tKS�� �&N����25bA2��g���W�v�y��B�I�5���:��N��k���7`�(vBh>� Shh�� 1:x�oJO#�i��N?F R��� ��|y� 1dyqպ3'�2��jN��V�/ ���b�k��R�rw�?Q@|f1N6#O�T�啦�p�:���?.����Z.k��`|��u
1
+ �ҟAd�����I����L��L9���Q�*��o�qu��Β�p�S���f%�SGCtL�:�
2
+ Zut�+yh5e�PQ���R�����&)��4 '���;Rѵ�KL��{���$�W���k� A0�x���C?Wܔ�EK��鴳��8��<k��|��}~4Ƌ�R����ܽo$��A`d$&�ǡ�����We�עz<N"