ruby2ruby 2.5.0 → 2.5.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 +0 -0
- data/History.rdoc +6 -0
- data/lib/ruby2ruby.rb +7 -6
- data/test/test_ruby2ruby.rb +27 -4
- data.tar.gz.sig +1 -5
- metadata +13 -13
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce3916335beb18e635634b93a85be8c88aaaab6029aea5ba5426b429cebbb2a6
|
4
|
+
data.tar.gz: e443e89cd7216bee0ae5d2fc8b182cafb94827357cb82d2b248cb19e2a26b6bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62655af018fce2402bb410d7606afb34f7a6f332c88fc74aca6ebf9faf5f37abd23d9827cfd5d5742d3240d89ae838f4ef7d28f92da7bc520c335467b89a448a
|
7
|
+
data.tar.gz: 637c87a736b4da72487c95bc8fa981d49ba9b57e3e8f48c2013ef52bbbcb09176c0abfae18b272cba551adcb5961bcad6e94fa38dee8352f154986861cf7e616
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
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.5.
|
34
|
+
VERSION = "2.5.1" # :nodoc:
|
35
35
|
|
36
36
|
# cutoff for one-liners
|
37
37
|
LINE_LENGTH = 78
|
@@ -475,7 +475,7 @@ class Ruby2Ruby < SexpProcessor
|
|
475
475
|
|
476
476
|
options = re_opt rest.pop if Integer === rest.last
|
477
477
|
|
478
|
-
"/"
|
478
|
+
"/" + util_dthing(:dregx, s(:dregx, str, *rest)) << "/#{options}"
|
479
479
|
end
|
480
480
|
|
481
481
|
def process_dregx_once(exp) # :nodoc:
|
@@ -502,7 +502,7 @@ class Ruby2Ruby < SexpProcessor
|
|
502
502
|
ens = process(ens) || "# do nothing"
|
503
503
|
ens = "begin\n#{ens}\nend\n" if ens =~ /(^|\n)rescue/
|
504
504
|
|
505
|
-
body.sub
|
505
|
+
body = body.sub(/\n\s*end\z/, "")
|
506
506
|
body = indent(body) unless body =~ /(^|\n)rescue/
|
507
507
|
|
508
508
|
"#{body}\nensure\n#{indent ens}"
|
@@ -699,11 +699,12 @@ class Ruby2Ruby < SexpProcessor
|
|
699
699
|
return r if r and (@indent + r).size < LINE_LENGTH and r !~ /\n/
|
700
700
|
end
|
701
701
|
|
702
|
-
r =
|
702
|
+
r = []
|
703
|
+
r << "if #{c} then\n#{indent(t)}\n"
|
703
704
|
r << "else\n#{indent(f)}\n" if f
|
704
705
|
r << "end"
|
705
706
|
|
706
|
-
r
|
707
|
+
r.join
|
707
708
|
elsif f
|
708
709
|
unless expand then
|
709
710
|
r = "#{f} unless #{c}"
|
@@ -745,7 +746,7 @@ class Ruby2Ruby < SexpProcessor
|
|
745
746
|
%w[ do end ]
|
746
747
|
end
|
747
748
|
|
748
|
-
iter.sub
|
749
|
+
iter = iter.sub(/\(\)$/, "")
|
749
750
|
|
750
751
|
# REFACTOR: ugh
|
751
752
|
result = []
|
data/test/test_ruby2ruby.rb
CHANGED
@@ -42,6 +42,15 @@ class TestRuby2Ruby < R2RTestCase
|
|
42
42
|
@processor = Ruby2Ruby.new
|
43
43
|
end
|
44
44
|
|
45
|
+
# some things don't work in earlier rubies... oh well.
|
46
|
+
def skip30
|
47
|
+
skip unless RUBY_VERSION > "3.0"
|
48
|
+
end
|
49
|
+
|
50
|
+
def skip31
|
51
|
+
skip unless RUBY_VERSION > "3.1"
|
52
|
+
end
|
53
|
+
|
45
54
|
def do_not_check_sexp!
|
46
55
|
@check_sexp = false
|
47
56
|
end
|
@@ -438,8 +447,10 @@ class TestRuby2Ruby < R2RTestCase
|
|
438
447
|
end
|
439
448
|
|
440
449
|
def test_forward_args__call
|
441
|
-
|
442
|
-
|
450
|
+
skip31
|
451
|
+
|
452
|
+
inn = s(:defn, :x, s(:args, s(:forward_args)), s(:call, nil, :y, s(:forward_args)))
|
453
|
+
out = "def x(...)\n y(...)\nend"
|
443
454
|
|
444
455
|
assert_parse inn, out
|
445
456
|
end
|
@@ -763,16 +774,22 @@ class TestRuby2Ruby < R2RTestCase
|
|
763
774
|
end
|
764
775
|
|
765
776
|
def test_case_in__array_pat_19
|
777
|
+
skip31
|
778
|
+
|
766
779
|
assert_case_in "[^@a, ^$b, ^@@c]", s(:array_pat, nil, s(:ivar, :@a), s(:gvar, :$b), s(:cvar, :@@c)) # HACK: really not sure about this one
|
767
780
|
end
|
768
781
|
|
769
782
|
def test_case_in__find_pat_1
|
783
|
+
skip30
|
784
|
+
|
770
785
|
assert_case_in "[*a, :+, *b]", s(:find_pat, nil, :"*a",
|
771
786
|
s(:lit, :+),
|
772
787
|
:"*b")
|
773
788
|
end
|
774
789
|
|
775
790
|
def test_case_in__find_pat_2
|
791
|
+
skip30
|
792
|
+
|
776
793
|
assert_case_in "[*, :b, ^c, *]", s(:find_pat, nil,
|
777
794
|
:*,
|
778
795
|
s(:lit, :b), s(:lvar, :c),
|
@@ -780,6 +797,8 @@ class TestRuby2Ruby < R2RTestCase
|
|
780
797
|
end
|
781
798
|
|
782
799
|
def test_case_in__find_pat_3
|
800
|
+
skip30
|
801
|
+
|
783
802
|
assert_case_in("Array(*b, n, { a: }, m, *a)",
|
784
803
|
s(:find_pat,
|
785
804
|
s(:const, :Array),
|
@@ -792,6 +811,8 @@ class TestRuby2Ruby < R2RTestCase
|
|
792
811
|
end
|
793
812
|
|
794
813
|
def test_case_in__find_pat_4
|
814
|
+
skip30
|
815
|
+
|
795
816
|
assert_case_in("*b, n, { a: }, m, *a", s(:find_pat,
|
796
817
|
nil,
|
797
818
|
:"*b",
|
@@ -803,6 +824,8 @@ class TestRuby2Ruby < R2RTestCase
|
|
803
824
|
end
|
804
825
|
|
805
826
|
def test_case_in__find_pat_5
|
827
|
+
skip30
|
828
|
+
|
806
829
|
assert_case_in("Array(*lhs, ^b, *rhs)", s(:find_pat,
|
807
830
|
s(:const, :Array),
|
808
831
|
:"*lhs",
|
@@ -1087,7 +1110,7 @@ class TestRuby2Ruby < R2RTestCase
|
|
1087
1110
|
end
|
1088
1111
|
|
1089
1112
|
def ruby_parser
|
1090
|
-
parser = RubyParser.
|
1113
|
+
parser = RubyParser.latest
|
1091
1114
|
|
1092
1115
|
%i[a b c d].each do |v|
|
1093
1116
|
parser.env[v] = :lvar
|
@@ -1155,7 +1178,7 @@ ir2r = File.read("lib/ruby2ruby.rb")
|
|
1155
1178
|
require "ruby_parser"
|
1156
1179
|
|
1157
1180
|
def morph_and_eval src, from, to, processor
|
1158
|
-
parser = RubyParser.
|
1181
|
+
parser = RubyParser.latest
|
1159
1182
|
new_src = processor.new.process(parser.process(src.sub(from, to)))
|
1160
1183
|
|
1161
1184
|
eval new_src
|
data.tar.gz.sig
CHANGED
@@ -1,5 +1 @@
|
|
1
|
-
|
2
|
-
/s�3V�>N)ɗ�R���3Я�L��U3�����.��j�%Iս��t�,���O
|
3
|
-
�p�Z~�ʤL*L�/ޓͲh���>�{�^~<����y�Y�Ɇ�Lk=��+�l��l��a��V��羖M���
|
4
|
-
%�B�BQ�
|
5
|
-
���UpH�u1d]TUaU
|
1
|
+
��~--]䛱��ߴ���O��t�Z����¦�~=�$-]h�<�<-�>eq�a�pܳ����)o���K�)'�O����z�s�t�cl�̲��J�!Dt���+��5��#�B~�U�R�\�#H��xHD4Q� x�!<�S�=.�k��]P�9ڮyk#5o}5�8�QғPƧ��i6`>����%<��w�M,�B0P����'��u=+�*��j2�K~MѲ ���It(z_ω"B$4]
|
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.5.
|
4
|
+
version: 2.5.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
|
+
MIIDPjCCAiagAwIBAgIBCDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTI0MDEwMjIxMjEyM1oXDTI1MDEwMTIxMjEyM1owRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -22,14 +22,14 @@ cert_chain:
|
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
24
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
AQCygvpmncmkiSs9r/Kceo4bBPDszhTv6iBi4LwMReqnFrpNLMOWJw7xi8x+3eL2
|
26
|
+
XS09ZPNOt2zm70KmFouBMgOysnDY4k2dE8uF6B8JbZOO8QfalW+CoNBliefOTcn2
|
27
|
+
bg5IOP7UoGM5lC174/cbDJrJnRG9bzig5FAP0mvsgA8zgTRXQzIUAZEo92D5K7p4
|
28
|
+
B4/O998ho6BSOgYBI9Yk1ttdCtti6Y+8N9+fZESsjtWMykA+WXWeGUScHqiU+gH8
|
29
|
+
S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
|
30
|
+
deKfBjgVAq7EYHu1AczzlUly
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: sexp_processor
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '4.2'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '4.2'
|
96
96
|
description: |-
|
97
97
|
ruby2ruby provides a means of generating pure ruby code easily from
|
98
98
|
RubyParser compatible Sexps. This makes making dynamic language
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.5.14
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser
|
metadata.gz.sig
CHANGED
Binary file
|