ruby-next-core 0.11.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/README.md +17 -3
- data/lib/.rbnext/2.1/ruby-next/core.rb +206 -0
- data/lib/.rbnext/2.1/ruby-next/language.rb +227 -0
- data/lib/.rbnext/2.3/ruby-next/commands/nextify.rb +1 -1
- data/lib/.rbnext/2.3/ruby-next/language/eval.rb +1 -1
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/base.rb +4 -4
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/endless_range.rb +1 -1
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/pattern_matching.rb +3 -3
- data/lib/.rbnext/2.3/ruby-next/utils.rb +1 -1
- data/lib/.rbnext/2.7/ruby-next/core.rb +3 -0
- data/lib/ruby-next/config.rb +6 -1
- data/lib/ruby-next/core/array/intersect.rb +9 -0
- data/lib/ruby-next/core/constants/frozen_error.rb +15 -0
- data/lib/ruby-next/core/enumerable/tally.rb +46 -7
- data/lib/ruby-next/core.rb +3 -0
- data/lib/ruby-next/core_ext.rb +1 -1
- data/lib/ruby-next/language/parser.rb +0 -3
- data/lib/ruby-next/language/rewriters/args_forward.rb +6 -2
- data/lib/ruby-next/language/rewriters/args_forward_leading.rb +1 -1
- data/lib/ruby-next/language/rewriters/method_reference.rb +1 -1
- data/lib/ruby-next/language/rewriters/numeric_literals.rb +41 -0
- data/lib/ruby-next/language/rewriters/pattern_matching.rb +1 -1
- data/lib/ruby-next/language/rewriters/required_kwargs.rb +39 -0
- data/lib/ruby-next/language/rewriters/safe_navigation.rb +42 -29
- data/lib/ruby-next/language/rewriters/shorthand_hash.rb +1 -1
- data/lib/ruby-next/language/setup.rb +3 -2
- data/lib/ruby-next/language/unparser.rb +3 -8
- data/lib/ruby-next/language.rb +50 -43
- data/lib/ruby-next/setup_self.rb +3 -1
- data/lib/ruby-next/version.rb +1 -1
- metadata +14 -14
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RubyNext::Core.patch Object,
|
4
|
+
name: "FrozenError",
|
5
|
+
method: nil,
|
6
|
+
refineable: [],
|
7
|
+
version: "2.5",
|
8
|
+
# avoid defining the constant twice, 'causae it's already included in core
|
9
|
+
# we only use the contents in `ruby-next core_ext`.
|
10
|
+
supported: true,
|
11
|
+
location: [__FILE__, __LINE__ + 2] do
|
12
|
+
<<-RUBY
|
13
|
+
FrozenError ||= RuntimeError
|
14
|
+
RUBY
|
15
|
+
end
|
@@ -1,12 +1,51 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
# Ruby 3.1 adds an ability to pass a hash as accumulator.
|
4
|
+
#
|
5
|
+
# NOTE: We have separate patches for MRI 3.0+ and others due to the unsupported refinements vs modules behaviour.
|
6
|
+
if Enumerable.method_defined?(:tally) && ([].method(:tally).arity == 0) && !(defined?(JRUBY_VERSION) || defined?(TruffleRuby))
|
7
|
+
RubyNext::Core.patch name: "TallyWithHash", supported: false, native: nil, method: :tally, version: "3.1", refineable: [Enumerable] do
|
8
|
+
<<-'RUBY'
|
9
|
+
def tally(*attrs)
|
10
|
+
return super() if attrs.size.zero?
|
11
|
+
|
12
|
+
raise ArgumentError, "wrong number of arguments (given #{attrs.size}, expected 0..1)" if attrs.size > 1
|
13
|
+
|
14
|
+
hash = attrs.size.zero? ? {} : attrs[0].to_hash
|
15
|
+
raise FrozenError, "can't modify frozen #{hash.class}: #{hash}" if hash.frozen?
|
16
|
+
|
17
|
+
each_with_object(hash) do |v, acc|
|
18
|
+
acc[v] = 0 unless acc.key?(v)
|
19
|
+
acc[v] += 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
RUBY
|
23
|
+
end
|
24
|
+
else
|
25
|
+
RubyNext::Core.patch Enumerable, method: :tally, version: "3.1", refineable: [Enumerable, Array] do
|
26
|
+
<<-'RUBY'
|
27
|
+
def tally(acc = {})
|
28
|
+
hash = acc.to_hash
|
29
|
+
raise FrozenError, "can't modify frozen #{hash.class}: #{hash}" if hash.frozen?
|
30
|
+
|
31
|
+
each_with_object(hash) do |v, acc|
|
32
|
+
acc[v] = 0 unless acc.key?(v)
|
33
|
+
acc[v] += 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
RUBY
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# This patch is intended for core extensions only (since we can not use prepend here)
|
41
|
+
RubyNext::Core.patch Enumerable, name: "TallyWithHashCoreExt", version: "3.1", supported: Enumerable.method_defined?(:tally) && ([].method(:tally).arity != 0), method: :tally, refineable: [] do
|
42
|
+
<<-'RUBY'
|
43
|
+
def tally(acc = {})
|
44
|
+
hash = acc.to_hash
|
45
|
+
raise FrozenError, "can't modify frozen #{hash.class}: #{hash}" if hash.frozen?
|
46
|
+
|
47
|
+
each_with_object(hash) do |v, acc|
|
48
|
+
acc[v] = 0 unless acc.key?(v)
|
10
49
|
acc[v] += 1
|
11
50
|
end
|
12
51
|
end
|
data/lib/ruby-next/core.rb
CHANGED
@@ -181,6 +181,7 @@ unless defined?(NoMatchingPatternError)
|
|
181
181
|
end
|
182
182
|
|
183
183
|
require "ruby-next/core/constants/no_matching_pattern_error"
|
184
|
+
require "ruby-next/core/constants/frozen_error"
|
184
185
|
require "ruby-next/core/array/deconstruct"
|
185
186
|
require "ruby-next/core/hash/deconstruct_keys"
|
186
187
|
require "ruby-next/core/struct/deconstruct"
|
@@ -188,6 +189,8 @@ require "ruby-next/core/struct/deconstruct_keys"
|
|
188
189
|
|
189
190
|
require "ruby-next/core/hash/except"
|
190
191
|
|
192
|
+
require "ruby-next/core/array/intersect"
|
193
|
+
|
191
194
|
# Generate refinements
|
192
195
|
RubyNext.module_eval do
|
193
196
|
RubyNext::Core.patches.refined.each do |mod, patches|
|
data/lib/ruby-next/core_ext.rb
CHANGED
@@ -19,9 +19,6 @@ module RubyNext
|
|
19
19
|
class Builder < ::Parser::Builders::Default
|
20
20
|
modernize
|
21
21
|
|
22
|
-
# Unparser doesn't support kwargs node yet
|
23
|
-
self.emit_kwargs = false if respond_to?(:emit_kwargs=)
|
24
|
-
|
25
22
|
unless method_defined?(:match_pattern_p)
|
26
23
|
include BuilderExt
|
27
24
|
end
|
@@ -11,16 +11,20 @@ module RubyNext
|
|
11
11
|
REST = :__rest__
|
12
12
|
BLOCK = :__block__
|
13
13
|
|
14
|
-
def
|
14
|
+
def on_args(node)
|
15
|
+
farg = node.children.find { |child| child.is_a?(::Parser::AST::Node) && child.type == :forward_arg }
|
16
|
+
return unless farg
|
17
|
+
|
15
18
|
context.track! self
|
16
19
|
|
17
20
|
node = super(node)
|
18
21
|
|
19
|
-
replace(
|
22
|
+
replace(farg.loc.expression, "*#{REST}, &#{BLOCK}")
|
20
23
|
|
21
24
|
node.updated(
|
22
25
|
:args,
|
23
26
|
[
|
27
|
+
*node.children.slice(0, node.children.index(farg)),
|
24
28
|
s(:restarg, REST),
|
25
29
|
s(:blockarg, BLOCK)
|
26
30
|
]
|
@@ -6,7 +6,7 @@ module RubyNext
|
|
6
6
|
class MethodReference < Base
|
7
7
|
NAME = "method-reference"
|
8
8
|
SYNTAX_PROBE = "Language.:transform"
|
9
|
-
MIN_SUPPORTED_VERSION = Gem::Version.new(
|
9
|
+
MIN_SUPPORTED_VERSION = Gem::Version.new(RubyNext::NEXT_VERSION)
|
10
10
|
|
11
11
|
def on_meth_ref(node)
|
12
12
|
context.track! self
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyNext
|
4
|
+
module Language
|
5
|
+
module Rewriters
|
6
|
+
class NumericLiterals < Base
|
7
|
+
using RubyNext
|
8
|
+
|
9
|
+
NAME = "numeric-literals"
|
10
|
+
SYNTAX_PROBE = "2i + 1/2r"
|
11
|
+
MIN_SUPPORTED_VERSION = Gem::Version.new("2.1.0")
|
12
|
+
|
13
|
+
def on_rational(node)
|
14
|
+
context.track! self
|
15
|
+
|
16
|
+
val = node.children.first
|
17
|
+
|
18
|
+
parts = [s(:int, val.numerator)]
|
19
|
+
|
20
|
+
parts << s(:int, val.denominator) unless val.denominator == 1
|
21
|
+
|
22
|
+
s(:send, nil, :Rational, *parts).tap do |new_node|
|
23
|
+
replace(node.loc.expression, new_node)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_complex(node)
|
28
|
+
context.track! self
|
29
|
+
|
30
|
+
val = node.children.first
|
31
|
+
|
32
|
+
s(:send, nil, :Complex,
|
33
|
+
s(:int, val.real),
|
34
|
+
s(:int, val.imaginary)).tap do |new_node|
|
35
|
+
replace(node.loc.expression, new_node)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyNext
|
4
|
+
module Language
|
5
|
+
module Rewriters
|
6
|
+
class RequiredKwargs < Base
|
7
|
+
using RubyNext
|
8
|
+
|
9
|
+
NAME = "required-kwargs"
|
10
|
+
SYNTAX_PROBE = "obj = Object.new; def obj.foo(x:, y: 1); end"
|
11
|
+
MIN_SUPPORTED_VERSION = Gem::Version.new("2.1.0")
|
12
|
+
|
13
|
+
def on_kwarg(node)
|
14
|
+
context.track! self
|
15
|
+
|
16
|
+
name = node.children[0]
|
17
|
+
|
18
|
+
new_node = node.updated(
|
19
|
+
:kwoptarg,
|
20
|
+
[name, raise_missing_keyword(name)]
|
21
|
+
)
|
22
|
+
|
23
|
+
replace(node.loc.expression, "#{name}: ::Kernel.raise(::ArgumentError, \"missing keyword: #{name}\")")
|
24
|
+
|
25
|
+
new_node
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def raise_missing_keyword(name)
|
31
|
+
s(:send,
|
32
|
+
s(:const, s(:cbase), :Kernel), :raise,
|
33
|
+
s(:const, s(:cbase), :ArgumentError),
|
34
|
+
s(:str, "missing keyword: #{name}"))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -8,6 +8,8 @@ module RubyNext
|
|
8
8
|
SYNTAX_PROBE = "nil&.x&.nil?"
|
9
9
|
MIN_SUPPORTED_VERSION = Gem::Version.new("2.3.0")
|
10
10
|
|
11
|
+
SAFE_LVAR = :__safe_lvar__
|
12
|
+
|
11
13
|
def on_csend(node)
|
12
14
|
node = super(node)
|
13
15
|
|
@@ -20,7 +22,7 @@ module RubyNext
|
|
20
22
|
:and,
|
21
23
|
[
|
22
24
|
process(safe_navigation(receiver)),
|
23
|
-
s(:send,
|
25
|
+
s(:send, safe_lvar, *args)
|
24
26
|
]
|
25
27
|
))
|
26
28
|
|
@@ -34,18 +36,15 @@ module RubyNext
|
|
34
36
|
|
35
37
|
context.track!(self)
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
:and,
|
40
|
-
[
|
41
|
-
process(safe_navigation(node.children[0].children[0])),
|
42
|
-
process(node.updated(nil, node.children.map(&method(:decsendize))))
|
43
|
-
]
|
44
|
-
)))
|
39
|
+
super(decsendize(node))
|
40
|
+
end
|
45
41
|
|
46
|
-
|
42
|
+
def on_numblock(node)
|
43
|
+
return super(node) unless node.children[0].type == :csend
|
47
44
|
|
48
|
-
|
45
|
+
context.track!(self)
|
46
|
+
|
47
|
+
super(decsendize(node))
|
49
48
|
end
|
50
49
|
|
51
50
|
def on_op_asgn(node)
|
@@ -53,37 +52,51 @@ module RubyNext
|
|
53
52
|
|
54
53
|
context.track!(self)
|
55
54
|
|
55
|
+
super(decsendize(node))
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def decsendize(node)
|
61
|
+
csend, *children = node.children
|
62
|
+
|
63
|
+
receiver, *other = csend.children
|
64
|
+
|
65
|
+
new_csend = csend.updated(:send, [safe_lvar, *other])
|
66
|
+
|
56
67
|
new_node = s(:begin,
|
57
|
-
|
68
|
+
node.updated(
|
58
69
|
:and,
|
59
70
|
[
|
60
|
-
process(safe_navigation(
|
61
|
-
process(node.updated(nil,
|
71
|
+
process(safe_navigation(receiver)),
|
72
|
+
process(node.updated(nil, [new_csend, *children]))
|
62
73
|
]
|
63
|
-
))
|
74
|
+
))
|
64
75
|
|
65
76
|
replace(node.loc.expression, new_node)
|
66
77
|
|
67
78
|
new_node
|
68
79
|
end
|
69
80
|
|
70
|
-
|
71
|
-
|
72
|
-
def decsendize(node)
|
73
|
-
return node unless node.is_a?(::Parser::AST::Node) && node.type == :csend
|
74
|
-
|
75
|
-
node.updated(:send, node.children.map(&method(:decsendize)))
|
76
|
-
end
|
77
|
-
|
78
|
-
# Transform: x&.y -> (!x.nil? && x.y) || nil
|
81
|
+
# Transform: x&.y -> ((_tmp_ = x) || true) && (!_tmp_.nil? || nil) && _tmp_.y
|
79
82
|
# This allows us to handle `false&.to_s == "false"`
|
80
83
|
def safe_navigation(node)
|
81
84
|
s(:begin,
|
82
|
-
s(:
|
83
|
-
s(:
|
84
|
-
s(:
|
85
|
-
|
86
|
-
|
85
|
+
s(:and,
|
86
|
+
s(:begin,
|
87
|
+
s(:or,
|
88
|
+
s(:begin, s(:lvasgn, SAFE_LVAR, node)),
|
89
|
+
s(:true))),
|
90
|
+
s(:begin,
|
91
|
+
s(:or,
|
92
|
+
s(:send,
|
93
|
+
s(:send, safe_lvar, :nil?),
|
94
|
+
:!),
|
95
|
+
s(:nil)))))
|
96
|
+
end
|
97
|
+
|
98
|
+
def safe_lvar
|
99
|
+
s(:lvar, SAFE_LVAR)
|
87
100
|
end
|
88
101
|
end
|
89
102
|
end
|
@@ -6,7 +6,7 @@ module RubyNext
|
|
6
6
|
class ShorthandHash < Base
|
7
7
|
NAME = "shorthand-hash"
|
8
8
|
SYNTAX_PROBE = "data = {x}"
|
9
|
-
MIN_SUPPORTED_VERSION = Gem::Version.new(
|
9
|
+
MIN_SUPPORTED_VERSION = Gem::Version.new(RubyNext::NEXT_VERSION)
|
10
10
|
|
11
11
|
def on_ipair(node)
|
12
12
|
context.track! self
|
@@ -30,7 +30,7 @@ module RubyNext
|
|
30
30
|
|
31
31
|
def setup_gem_load_path(lib_dir = "lib", rbnext_dir: RUBY_NEXT_DIR, transpile: false)
|
32
32
|
called_from = caller_locations(1, 1).first.path
|
33
|
-
dirname = File.dirname(called_from)
|
33
|
+
dirname = File.realpath(File.dirname(called_from))
|
34
34
|
|
35
35
|
loop do
|
36
36
|
basename = File.basename(dirname)
|
@@ -50,7 +50,8 @@ module RubyNext
|
|
50
50
|
GemTranspiler.maybe_transpile(File.dirname(dirname), lib_dir, next_dirname) if transpile
|
51
51
|
|
52
52
|
current_index = $LOAD_PATH.find_index do |load_path|
|
53
|
-
Pathname.new(load_path)
|
53
|
+
pn = Pathname.new(load_path)
|
54
|
+
pn.exist? && pn.realpath.to_s == dirname
|
54
55
|
end
|
55
56
|
|
56
57
|
raise "Gem's lib is not in the $LOAD_PATH: #{dirname}" if current_index.nil?
|
@@ -7,12 +7,7 @@ $VERBOSE = save_verbose
|
|
7
7
|
|
8
8
|
require "unparser"
|
9
9
|
|
10
|
-
#
|
11
|
-
if defined?
|
12
|
-
|
13
|
-
def dispatch
|
14
|
-
super
|
15
|
-
nl unless branch
|
16
|
-
end
|
17
|
-
end)
|
10
|
+
# For backward compatibility with older Unparser
|
11
|
+
if RubyNext::Language::Builder.respond_to?(:emit_kwargs=) && !defined?(Unparser::Emitter::Kwargs)
|
12
|
+
RubyNext::Language::Builder.emit_kwargs = false
|
18
13
|
end
|
data/lib/ruby-next/language.rb
CHANGED
@@ -94,53 +94,29 @@ module RubyNext
|
|
94
94
|
@runtime
|
95
95
|
end
|
96
96
|
|
97
|
-
def transform(
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
97
|
+
def transform(source, rewriters: self.rewriters, using: RubyNext::Core.refine?, context: TransformContext.new)
|
98
|
+
retried = 0
|
99
|
+
new_source = nil
|
100
|
+
begin
|
101
|
+
new_source =
|
102
|
+
if mode == :rewrite
|
103
|
+
rewrite(source, rewriters: rewriters, using: using, context: context)
|
104
|
+
else
|
105
|
+
regenerate(source, rewriters: rewriters, using: using, context: context)
|
106
|
+
end
|
107
|
+
rescue Unparser::UnknownNodeError => err
|
108
|
+
RubyNext.warn "Ruby Next fallbacks to \"rewrite\" transpiling mode since the version of Unparser you use doesn't support some syntax yet: #{err.message}.\n" \
|
109
|
+
"Try upgrading the Unparser or set transpiling mode to \"rewrite\" in case you use some edge or experimental syntax."
|
107
110
|
self.mode = :rewrite
|
111
|
+
retried += 1
|
112
|
+
retry unless retried > 1
|
113
|
+
raise
|
108
114
|
end
|
109
|
-
rewrite(*args, **kwargs)
|
110
|
-
end
|
111
|
-
|
112
|
-
def regenerate(source, rewriters: self.rewriters, using: RubyNext::Core.refine?, context: TransformContext.new)
|
113
|
-
parse_with_comments(source).then do |(ast, comments)|
|
114
|
-
rewriters.inject(ast) do |tree, rewriter|
|
115
|
-
rewriter.new(context).process(tree)
|
116
|
-
end.then do |new_ast|
|
117
|
-
next source unless context.dirty?
|
118
|
-
|
119
|
-
Unparser.unparse(new_ast, comments)
|
120
|
-
end.then do |source|
|
121
|
-
next source unless RubyNext::Core.refine?
|
122
|
-
next source unless using && context.use_ruby_next?
|
123
|
-
|
124
|
-
Core.inject! source.dup
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def rewrite(source, rewriters: self.rewriters, using: RubyNext::Core.refine?, context: TransformContext.new)
|
130
|
-
rewriters.inject(source) do |src, rewriter|
|
131
|
-
buffer = Parser::Source::Buffer.new("<dynamic>")
|
132
|
-
buffer.source = src
|
133
115
|
|
134
|
-
|
135
|
-
|
136
|
-
next source unless context.dirty?
|
137
|
-
new_source
|
138
|
-
end.then do |source|
|
139
|
-
next source unless RubyNext::Core.refine?
|
140
|
-
next source unless using && context.use_ruby_next?
|
116
|
+
return new_source unless RubyNext::Core.refine?
|
117
|
+
return new_source unless using && context.use_ruby_next?
|
141
118
|
|
142
|
-
|
143
|
-
end
|
119
|
+
Core.inject! new_source.dup
|
144
120
|
end
|
145
121
|
|
146
122
|
def transformable?(path)
|
@@ -164,6 +140,31 @@ module RubyNext
|
|
164
140
|
|
165
141
|
private
|
166
142
|
|
143
|
+
def regenerate(source, rewriters:, using:, context:)
|
144
|
+
parse_with_comments(source).then do |(ast, comments)|
|
145
|
+
rewriters.inject(ast) do |tree, rewriter|
|
146
|
+
rewriter.new(context).process(tree)
|
147
|
+
end.then do |new_ast|
|
148
|
+
next source unless context.dirty?
|
149
|
+
|
150
|
+
Unparser.unparse(new_ast, comments)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def rewrite(source, rewriters:, using:, context:)
|
156
|
+
rewriters.inject(source) do |src, rewriter|
|
157
|
+
buffer = Parser::Source::Buffer.new("<dynamic>")
|
158
|
+
buffer.source = src
|
159
|
+
|
160
|
+
rewriter.new(context).rewrite(buffer, parse(src))
|
161
|
+
end.then do |new_source|
|
162
|
+
next source unless context.dirty?
|
163
|
+
|
164
|
+
new_source
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
167
168
|
attr_writer :watch_dirs
|
168
169
|
end
|
169
170
|
|
@@ -179,6 +180,12 @@ module RubyNext
|
|
179
180
|
require "ruby-next/language/rewriters/safe_navigation"
|
180
181
|
rewriters << Rewriters::SafeNavigation
|
181
182
|
|
183
|
+
require "ruby-next/language/rewriters/numeric_literals"
|
184
|
+
rewriters << Rewriters::NumericLiterals
|
185
|
+
|
186
|
+
require "ruby-next/language/rewriters/required_kwargs"
|
187
|
+
rewriters << Rewriters::RequiredKwargs
|
188
|
+
|
182
189
|
require "ruby-next/language/rewriters/args_forward"
|
183
190
|
rewriters << Rewriters::ArgsForward
|
184
191
|
|
data/lib/ruby-next/setup_self.rb
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
version = RubyNext.next_ruby_version
|
7
7
|
next_dirname = File.join(__dir__, "..", ".rbnext")
|
8
8
|
lib_path = File.realpath(File.join(__dir__, ".."))
|
9
|
-
current_index = $LOAD_PATH.
|
9
|
+
current_index = $LOAD_PATH.find_index do |load_path|
|
10
|
+
File.exist?(load_path) && File.realpath(load_path) == lib_path
|
11
|
+
end
|
10
12
|
|
11
13
|
loop do
|
12
14
|
break unless version
|
data/lib/ruby-next/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-next-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-next-parser
|
@@ -28,20 +28,14 @@ dependencies:
|
|
28
28
|
name: unparser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.8
|
34
|
-
- - "<"
|
31
|
+
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: 0.6.0
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- - "
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.4.8
|
44
|
-
- - "<"
|
38
|
+
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: 0.6.0
|
47
41
|
description: "\n Ruby Next Core is a zero deps version of Ruby Next meant to be
|
@@ -62,6 +56,8 @@ files:
|
|
62
56
|
- bin/reparse
|
63
57
|
- bin/ruby-next
|
64
58
|
- bin/transform
|
59
|
+
- lib/.rbnext/2.1/ruby-next/core.rb
|
60
|
+
- lib/.rbnext/2.1/ruby-next/language.rb
|
65
61
|
- lib/.rbnext/2.3/ruby-next/commands/core_ext.rb
|
66
62
|
- lib/.rbnext/2.3/ruby-next/commands/nextify.rb
|
67
63
|
- lib/.rbnext/2.3/ruby-next/language/eval.rb
|
@@ -79,6 +75,8 @@ files:
|
|
79
75
|
- lib/ruby-next/core.rb
|
80
76
|
- lib/ruby-next/core/array/deconstruct.rb
|
81
77
|
- lib/ruby-next/core/array/difference_union_intersection.rb
|
78
|
+
- lib/ruby-next/core/array/intersect.rb
|
79
|
+
- lib/ruby-next/core/constants/frozen_error.rb
|
82
80
|
- lib/ruby-next/core/constants/no_matching_pattern_error.rb
|
83
81
|
- lib/ruby-next/core/enumerable/filter.rb
|
84
82
|
- lib/ruby-next/core/enumerable/filter_map.rb
|
@@ -114,7 +112,9 @@ files:
|
|
114
112
|
- lib/ruby-next/language/rewriters/in_pattern.rb
|
115
113
|
- lib/ruby-next/language/rewriters/method_reference.rb
|
116
114
|
- lib/ruby-next/language/rewriters/numbered_params.rb
|
115
|
+
- lib/ruby-next/language/rewriters/numeric_literals.rb
|
117
116
|
- lib/ruby-next/language/rewriters/pattern_matching.rb
|
117
|
+
- lib/ruby-next/language/rewriters/required_kwargs.rb
|
118
118
|
- lib/ruby-next/language/rewriters/runtime.rb
|
119
119
|
- lib/ruby-next/language/rewriters/runtime/dir.rb
|
120
120
|
- lib/ruby-next/language/rewriters/safe_navigation.rb
|
@@ -138,7 +138,7 @@ metadata:
|
|
138
138
|
documentation_uri: http://github.com/ruby-next/ruby-next/blob/master/README.md
|
139
139
|
homepage_uri: http://github.com/ruby-next/ruby-next
|
140
140
|
source_code_uri: http://github.com/ruby-next/ruby-next
|
141
|
-
post_install_message:
|
141
|
+
post_install_message:
|
142
142
|
rdoc_options: []
|
143
143
|
require_paths:
|
144
144
|
- lib
|
@@ -153,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
157
|
-
signing_key:
|
156
|
+
rubygems_version: 3.2.22
|
157
|
+
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Ruby Next core functionality
|
160
160
|
test_files: []
|