ruby2ruby 2.3.0 → 2.3.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -3
- data.tar.gz.sig +0 -0
- data/History.txt +10 -0
- data/lib/ruby2ruby.rb +34 -1
- data/test/test_ruby2ruby.rb +41 -0
- metadata +15 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7370313e3e5edb8daa2cbbf2fb09d692076c1b1d
|
4
|
+
data.tar.gz: 449fd3f4262f9edd0e112b5c4d5be7c2fe2804d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9894255594551689f3b4a0a6a1043fce8506d64ee10e89d5a77d0ea045b0ed373bcac2ea56ec06b7b23cbe80696bf78c1ad27053ddb566222fc3e8b6fb58c46
|
7
|
+
data.tar.gz: 850e6856e5a10e73f013e44ecc1a0e9873149c393f1652e7afdabc84780d4d1495f841e3cf0eb5973c722c582f04411c978c20ffc3c5d2dcc6330529934d351e
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
�
|
2
|
-
|
3
|
-
|
1
|
+
%�? �ܞ#C�4�����R��%\7S�i�a����Y
|
2
|
+
o�%�,�*��-!�C�R#�Ϋn�]:,�Q�W�IW�����Ŵ�j(����_�ν |Zֿxfd'�^���I���Uq��9�F3��qY3�/9��6�xjZ��Ljt�Y/wJ��pL
|
3
|
+
���g�+"GR䋎Z��E7���1�� �M�e�c1�D����*QW����'�m>��A��~E��6Y$8f�6 t�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/ruby2ruby.rb
CHANGED
@@ -31,7 +31,7 @@ end
|
|
31
31
|
# Generate ruby code from a sexp.
|
32
32
|
|
33
33
|
class Ruby2Ruby < SexpProcessor
|
34
|
-
VERSION = "2.3.
|
34
|
+
VERSION = "2.3.1" # :nodoc:
|
35
35
|
|
36
36
|
# cutoff for one-liners
|
37
37
|
LINE_LENGTH = 78
|
@@ -256,6 +256,8 @@ class Ruby2Ruby < SexpProcessor
|
|
256
256
|
when *BINARY then
|
257
257
|
if safe_call
|
258
258
|
"#{receiver}&.#{name}(#{args.join(', ')})"
|
259
|
+
elsif args.length > 1
|
260
|
+
"#{receiver}.#{name}(#{args.join(', ')})"
|
259
261
|
else
|
260
262
|
"(#{receiver} #{name} #{args.join(', ')})"
|
261
263
|
end
|
@@ -734,6 +736,16 @@ class Ruby2Ruby < SexpProcessor
|
|
734
736
|
"$#{exp.shift}"
|
735
737
|
end
|
736
738
|
|
739
|
+
def process_op_asgn(exp) # :nodoc:
|
740
|
+
# [[:lvar, :x], [:call, nil, :z, [:lit, 1]], :y, :"||"]
|
741
|
+
lhs = process(exp.shift)
|
742
|
+
rhs = process(exp.shift)
|
743
|
+
index = exp.shift
|
744
|
+
op = exp.shift
|
745
|
+
|
746
|
+
"#{lhs}.#{index} #{op}= #{rhs}"
|
747
|
+
end
|
748
|
+
|
737
749
|
def process_op_asgn1(exp) # :nodoc:
|
738
750
|
# [[:lvar, :b], [:arglist, [:lit, 1]], :"||", [:lit, 10]]
|
739
751
|
lhs = process(exp.shift)
|
@@ -854,6 +866,27 @@ class Ruby2Ruby < SexpProcessor
|
|
854
866
|
end
|
855
867
|
end
|
856
868
|
|
869
|
+
def process_safe_op_asgn(exp) # :nodoc:
|
870
|
+
# [[:lvar, :x], [:call, nil, :z, [:lit, 1]], :y, :"||"]
|
871
|
+
lhs = process(exp.shift)
|
872
|
+
rhs = process(exp.shift)
|
873
|
+
index = exp.shift
|
874
|
+
op = exp.shift
|
875
|
+
|
876
|
+
"#{lhs}&.#{index} #{op}= #{rhs}"
|
877
|
+
end
|
878
|
+
|
879
|
+
def process_safe_op_asgn2(exp) # :nodoc:
|
880
|
+
# [[:lvar, :c], :var=, :"||", [:lit, 20]]
|
881
|
+
lhs = process(exp.shift)
|
882
|
+
index = exp.shift.to_s[0..-2]
|
883
|
+
msg = exp.shift
|
884
|
+
|
885
|
+
rhs = process(exp.shift)
|
886
|
+
|
887
|
+
"#{lhs}&.#{index} #{msg}= #{rhs}"
|
888
|
+
end
|
889
|
+
|
857
890
|
def process_sclass(exp) # :nodoc:
|
858
891
|
"class << #{process(exp.shift)}\n#{indent(process_block(exp))}\nend"
|
859
892
|
end
|
data/test/test_ruby2ruby.rb
CHANGED
@@ -412,6 +412,28 @@ class TestRuby2Ruby < R2RTestCase
|
|
412
412
|
util_compare inn, out
|
413
413
|
end
|
414
414
|
|
415
|
+
def test_safe_op_asgn
|
416
|
+
inn = s(:safe_op_asgn,
|
417
|
+
s(:call, nil, :x),
|
418
|
+
s(:call, nil, :z, s(:lit, 1)),
|
419
|
+
:y,
|
420
|
+
:+)
|
421
|
+
|
422
|
+
out = "x&.y += z(1)"
|
423
|
+
util_compare inn, out
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_safe_op_asgn2
|
427
|
+
inn = s(:safe_op_asgn2,
|
428
|
+
s(:call, nil, :x),
|
429
|
+
:y=,
|
430
|
+
:"||",
|
431
|
+
s(:lit, 1))
|
432
|
+
|
433
|
+
out = "x&.y ||= 1"
|
434
|
+
util_compare inn, out
|
435
|
+
end
|
436
|
+
|
415
437
|
def test_splat_call
|
416
438
|
inn = s(:call, nil, :x,
|
417
439
|
s(:splat,
|
@@ -515,6 +537,14 @@ class TestRuby2Ruby < R2RTestCase
|
|
515
537
|
end
|
516
538
|
end
|
517
539
|
|
540
|
+
def test_binary_operators_with_multiple_arguments
|
541
|
+
Ruby2Ruby::BINARY.each do |op|
|
542
|
+
inn = s(:call, s(:lvar, :x), op, s(:lit, 2), s(:lit, 3))
|
543
|
+
out = "x.#{op}(2, 3)"
|
544
|
+
util_compare inn, out
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
518
548
|
def test_call_empty_hash
|
519
549
|
inn = s(:call, nil, :foo, s(:hash))
|
520
550
|
out = "foo({})"
|
@@ -591,6 +621,17 @@ class TestRuby2Ruby < R2RTestCase
|
|
591
621
|
util_compare inn, out
|
592
622
|
end
|
593
623
|
|
624
|
+
def test_op_asgn
|
625
|
+
inn = s(:op_asgn,
|
626
|
+
s(:call, nil, :x),
|
627
|
+
s(:call, nil, :z, s(:lit, 1)),
|
628
|
+
:y,
|
629
|
+
:+)
|
630
|
+
|
631
|
+
out = "x.y += z(1)"
|
632
|
+
util_compare inn, out
|
633
|
+
end
|
634
|
+
|
594
635
|
def test_rescue_block
|
595
636
|
inn = s(:rescue,
|
596
637
|
s(:call, nil, :alpha),
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6Xfj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 2016-
|
33
|
+
date: 2016-10-09 00:00:00.000000000 Z
|
33
34
|
dependencies:
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: sexp_processor
|
@@ -59,20 +60,6 @@ dependencies:
|
|
59
60
|
- - ~>
|
60
61
|
- !ruby/object:Gem::Version
|
61
62
|
version: '3.1'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: minitest
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5.8'
|
69
|
-
type: :development
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '5.8'
|
76
63
|
- !ruby/object:Gem::Dependency
|
77
64
|
name: rdoc
|
78
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +80,14 @@ dependencies:
|
|
93
80
|
requirements:
|
94
81
|
- - ~>
|
95
82
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
83
|
+
version: '3.15'
|
97
84
|
type: :development
|
98
85
|
prerelease: false
|
99
86
|
version_requirements: !ruby/object:Gem::Requirement
|
100
87
|
requirements:
|
101
88
|
- - ~>
|
102
89
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3.
|
90
|
+
version: '3.15'
|
104
91
|
description: |-
|
105
92
|
ruby2ruby provides a means of generating pure ruby code easily from
|
106
93
|
RubyParser compatible Sexps. This makes making dynamic language
|
metadata.gz.sig
CHANGED
Binary file
|