ruby2ruby 2.6.1 → 2.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47b02eac6d9da093ec8d57bd84e3b6d4d9e18120280b21de3265fa6e65cd87ae
4
- data.tar.gz: ad4413f10e596d3e6f7130c80f9dbda8e27c6899009f5c3a1da3b9f1cd59b249
3
+ metadata.gz: cee6fe46eb20e38e57a40e6b6e9547f23952190bf25fe5ae824d2d4b3584dfa8
4
+ data.tar.gz: 55273740bb6683b3a41a53d9ec0648a5f8d9bcee5db57c331d55ee885bde9864
5
5
  SHA512:
6
- metadata.gz: 06adf0bca90a2226800500f505de13a9432139d3472996f68377614c0eaca0a8e893055ca2fc8584e68dbdc8c8043eef7f9f91bd1b7c446c935803bcc5e101ba
7
- data.tar.gz: ac08f4635b66aca9005ab9f1c04d8f3a4b9a8aab863e250e6348ace8bb913858f7ca44385f82ca91bce4ac6b7bc08bbf790b983bb92a772131b8944d9709cb16
6
+ metadata.gz: 18c448df0eafe9e9ccabf9ece81b6126e2d8abf93c0a1c0e8e339d888133ec5b802f37578b438789e7f4acb0b102652fc7a8bd886fe30ecba3a3a9e55f2a5907
7
+ data.tar.gz: fda3b373d94fefa0d7bfd46d386f67e0c62ca979fcea2ab6ae8371583ce6b47ae73026ee6685d18792da94d9b3a5e98c8c499b9c4f660b936ac4cda74e0ef68c
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- ��rYH�۩G/�a���̹�k���R]MJ���$��MҀ��oS5Yj��k�����U����ה�}�n�
1
+ "m�����^ֵ�PbZ�+[��+�?�1[/���AHgTϝ�)������Ǎ́�n�V}���h�&�u�Ë�Q��oڻI@8�V&���M����������)��ɲ|��deL�p}�$��Z���t �20�<,��B\��"�����qJ/�z]Ot���3�|B������ˍ�.��-Z�ϙ�B$B"qA�@�-i^1)
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 2.6.2 / 2026-09-19
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Fixed block lvar processing for it, _1, etc.
6
+ * Fixed variable references in pattern match body. (ofedoren)
7
+
1
8
  === 2.6.1 / 2026-01-26
2
9
 
3
10
  * 1 bug fix:
data/Rakefile CHANGED
@@ -9,6 +9,7 @@ Hoe.add_include_dirs("lib",
9
9
  Hoe.plugin :seattlerb
10
10
  Hoe.plugin :isolate
11
11
  Hoe.plugin :rdoc
12
+ Hoe.plugin :cov
12
13
 
13
14
  Hoe.spec 'ruby2ruby' do
14
15
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
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.6.1" # :nodoc:
34
+ VERSION = "2.6.2" # :nodoc:
35
35
 
36
36
  # cutoff for one-liners
37
37
  LINE_LENGTH = 78
@@ -609,7 +609,11 @@ class Ruby2Ruby < SexpProcessor
609
609
  _, lhs, *rhs = exp
610
610
 
611
611
  cond = process lhs
612
- body = rhs.compact.map { |sexp| indent process sexp }
612
+ body = rhs.compact.map { |sexp|
613
+ in_context :in_body do
614
+ indent process sexp
615
+ end
616
+ }
613
617
 
614
618
  body << indent("# do nothing") if body.empty?
615
619
  body = body.join "\n"
@@ -11,7 +11,20 @@ require "fileutils"
11
11
  require "tmpdir"
12
12
  require "prism"
13
13
  require "timeout" # remove once upstreamed
14
- # require "prism/translation/ruby_parser" # not until upstreamed
14
+ require "prism/translation/ruby_parser" # not until upstreamed
15
+
16
+ class Prism::Translation::RubyParser
17
+ module TweakIt
18
+ def visit_it_local_variable_read_node(node) # TODO: upstream
19
+ s(node, :lvar, :it)
20
+ end
21
+
22
+ def visit_local_variable_read_node(node)
23
+ s(node, :lvar, node.name)
24
+ end
25
+ end
26
+ Compiler.prepend TweakIt
27
+ end
15
28
 
16
29
  class NotRubyParser < Prism::Translation::RubyParser # remove once upstreamed
17
30
  attr_accessor :scopes
@@ -58,10 +71,6 @@ class TestRuby2Ruby < R2RTestCase
58
71
  @processor = Ruby2Ruby.new
59
72
  end
60
73
 
61
- def skip_prism
62
- skip "not fully happy with prism yet"
63
- end
64
-
65
74
  def do_not_check_sexp!
66
75
  @check_sexp = false
67
76
  end
@@ -209,6 +218,18 @@ class TestRuby2Ruby < R2RTestCase
209
218
  assert_equal exp, Ruby2Ruby.new.process(NotRubyParser.new.parse(src))
210
219
  end
211
220
 
221
+ def test_block__lvar_it
222
+ inn = s(:iter, s(:call, nil, :fn), 0, s(:call, nil, :puts, s(:lvar, :it)))
223
+ out = "fn { puts(it) }"
224
+ assert_parse inn, out
225
+ end
226
+
227
+ def test_block__lvar__1
228
+ inn = s(:iter, s(:call, nil, :fn), 0, s(:call, nil, :puts, s(:lvar, :_1)))
229
+ out = "fn { puts(_1) }"
230
+ assert_parse inn, out
231
+ end
232
+
212
233
  def test_bug_033
213
234
  # gentle reminder to keep some sanity
214
235
  #
@@ -1002,6 +1023,16 @@ class TestRuby2Ruby < R2RTestCase
1002
1023
  assert_case_in "Object[b: 1]", s(:hash_pat, s(:const, :Object), s(:lit, :b), s(:lit, 1))
1003
1024
  end
1004
1025
 
1026
+ def test_case_in_body_does_not_pin_variables
1027
+ inn = s(:case, s(:call, nil, :x),
1028
+ s(:in,
1029
+ s(:array_pat, nil, s(:lasgn, :a), s(:lasgn, :b)),
1030
+ s(:lvar, :a)),
1031
+ nil)
1032
+ out = "case x\nin [a, b] then\n a\nend"
1033
+ assert_parse inn, out
1034
+ end
1035
+
1005
1036
  def test_interpolation_and_escapes
1006
1037
  # log_entry = " \e[#{message_color}m#{message}\e[0m "
1007
1038
  inn = s(:lasgn, :log_entry,
data.tar.gz.sig CHANGED
Binary file
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.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -64,38 +64,52 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '6.0'
67
+ version: '7.0'
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
- version: '8'
70
+ version: '9'
71
71
  type: :development
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: '6.0'
77
+ version: '7.0'
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
- version: '8'
80
+ version: '9'
81
+ - !ruby/object:Gem::Dependency
82
+ name: simplecov
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.21'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0.21'
81
95
  - !ruby/object:Gem::Dependency
82
96
  name: hoe
83
97
  requirement: !ruby/object:Gem::Requirement
84
98
  requirements:
85
99
  - - "~>"
86
100
  - !ruby/object:Gem::Version
87
- version: '4.5'
101
+ version: '4.7'
88
102
  type: :development
89
103
  prerelease: false
90
104
  version_requirements: !ruby/object:Gem::Requirement
91
105
  requirements:
92
106
  - - "~>"
93
107
  - !ruby/object:Gem::Version
94
- version: '4.5'
95
- description: |-
96
- ruby2ruby provides a means of generating pure ruby code easily from
97
- RubyParser compatible Sexps. This makes making dynamic language
98
- processors in ruby easier than ever!
108
+ version: '4.7'
109
+ description: "ruby2ruby provides a means of generating pure ruby code easily from\nRubyParser
110
+ compatible Sexps. This makes making dynamic language\nprocessors in ruby easier
111
+ than ever!\n\n== Features/Problems:\n \n* Clean, simple SexpProcessor generates
112
+ ruby code from RubyParser compatible sexps."
99
113
  email:
100
114
  - ryand-ruby@zenspider.com
101
115
  executables:
@@ -103,7 +117,6 @@ executables:
103
117
  extensions: []
104
118
  extra_rdoc_files:
105
119
  - History.rdoc
106
- - Manifest.txt
107
120
  - README.rdoc
108
121
  files:
109
122
  - ".autotest"
@@ -119,6 +132,7 @@ licenses:
119
132
  - MIT
120
133
  metadata:
121
134
  homepage_uri: https://github.com/seattlerb/ruby2ruby
135
+ documentation_uri: http://docs.seattlerb.org/ruby2ruby
122
136
  rdoc_options:
123
137
  - "--main"
124
138
  - README.rdoc
metadata.gz.sig CHANGED
Binary file