ruby-next-core 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +14 -4
- data/lib/.rbnext/2.3/ruby-next/commands/core_ext.rb +167 -0
- data/lib/.rbnext/2.3/ruby-next/commands/nextify.rb +198 -0
- data/lib/.rbnext/2.3/ruby-next/language/eval.rb +66 -0
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/base.rb +121 -0
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/endless_range.rb +63 -0
- data/lib/.rbnext/2.3/ruby-next/language/rewriters/pattern_matching.rb +944 -0
- data/lib/.rbnext/2.3/ruby-next/utils.rb +65 -0
- data/lib/ruby-next.rb +8 -6
- data/lib/ruby-next/cli.rb +2 -2
- data/lib/ruby-next/commands/core_ext.rb +1 -1
- data/lib/ruby-next/core.rb +27 -21
- data/lib/ruby-next/core/array/deconstruct.rb +9 -9
- data/lib/ruby-next/core/array/difference_union_intersection.rb +12 -12
- data/lib/ruby-next/core/constants/no_matching_pattern_error.rb +3 -3
- data/lib/ruby-next/core/enumerable/filter.rb +8 -8
- data/lib/ruby-next/core/enumerable/filter_map.rb +25 -25
- data/lib/ruby-next/core/enumerable/tally.rb +7 -7
- data/lib/ruby-next/core/enumerator/produce.rb +12 -12
- data/lib/ruby-next/core/hash/deconstruct_keys.rb +9 -9
- data/lib/ruby-next/core/hash/except.rb +11 -0
- data/lib/ruby-next/core/hash/merge.rb +8 -8
- data/lib/ruby-next/core/kernel/then.rb +2 -2
- data/lib/ruby-next/core/proc/compose.rb +11 -11
- data/lib/ruby-next/core/string/split.rb +6 -6
- data/lib/ruby-next/core/struct/deconstruct.rb +2 -2
- data/lib/ruby-next/core/struct/deconstruct_keys.rb +17 -17
- data/lib/ruby-next/core/symbol/end_with.rb +4 -4
- data/lib/ruby-next/core/symbol/start_with.rb +4 -4
- data/lib/ruby-next/core/time/ceil.rb +6 -6
- data/lib/ruby-next/core/time/floor.rb +4 -4
- data/lib/ruby-next/core/unboundmethod/bind_call.rb +4 -4
- data/lib/ruby-next/core_ext.rb +1 -1
- data/lib/ruby-next/language.rb +12 -1
- data/lib/ruby-next/language/parser.rb +0 -3
- data/lib/ruby-next/language/proposed.rb +3 -0
- data/lib/ruby-next/language/rewriters/args_forward.rb +23 -20
- data/lib/ruby-next/language/rewriters/base.rb +1 -1
- data/lib/ruby-next/language/rewriters/endless_method.rb +25 -3
- data/lib/ruby-next/language/rewriters/find_pattern.rb +44 -0
- data/lib/ruby-next/language/rewriters/method_reference.rb +1 -1
- data/lib/ruby-next/language/rewriters/pattern_matching.rb +102 -12
- data/lib/ruby-next/language/rewriters/right_hand_assignment.rb +1 -1
- data/lib/ruby-next/language/rewriters/safe_navigation.rb +87 -0
- data/lib/ruby-next/language/rewriters/shorthand_hash.rb +47 -0
- data/lib/ruby-next/language/rewriters/squiggly_heredoc.rb +36 -0
- data/lib/ruby-next/language/unparser.rb +0 -14
- data/lib/ruby-next/logging.rb +1 -1
- data/lib/ruby-next/rubocop.rb +15 -9
- data/lib/ruby-next/setup_self.rb +22 -0
- data/lib/ruby-next/version.rb +1 -1
- data/lib/uby-next.rb +8 -4
- metadata +20 -7
data/lib/ruby-next/logging.rb
CHANGED
data/lib/ruby-next/rubocop.rb
CHANGED
@@ -46,23 +46,25 @@ module RuboCop
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Let's make this file Ruby 2.2 compatible to avoid transpiling
|
50
|
+
# rubocop:disable Layout/HeredocIndentation
|
49
51
|
module RuboCop
|
50
52
|
module AST
|
51
53
|
module Traversal
|
52
54
|
# Fixed in https://github.com/rubocop-hq/rubocop/pull/7786
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
55
|
+
%i[case_match in_pattern find_pattern].each do |type|
|
56
|
+
next if method_defined?(:"on_#{type}")
|
57
|
+
module_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
58
|
+
def on_#{type}(node)
|
59
|
+
node.children.each { |child| send(:"on_\#{child.type}", child) if child }
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
RUBY
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end
|
67
|
+
# rubocop:enable Layout/HeredocIndentation
|
66
68
|
|
67
69
|
module RuboCop
|
68
70
|
module Cop
|
@@ -73,6 +75,10 @@ module RuboCop
|
|
73
75
|
trigger_responding_cops(:on_meth_ref, node)
|
74
76
|
end
|
75
77
|
|
78
|
+
def on_ipair(node)
|
79
|
+
trigger_responding_cops(:on_ipair, node)
|
80
|
+
end
|
81
|
+
|
76
82
|
unless method_defined?(:on_numblock)
|
77
83
|
def on_numblock(node)
|
78
84
|
children = node.children
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file setup LOAD_PATH to load Ruby Next own transpiled paths
|
4
|
+
# (we cannot use language/setup here, 'cause it requires Core to be loaded)
|
5
|
+
|
6
|
+
version = RubyNext.next_version
|
7
|
+
next_dirname = File.join(__dir__, "..", ".rbnext")
|
8
|
+
lib_path = File.realpath(File.join(__dir__, ".."))
|
9
|
+
current_index = $LOAD_PATH.index(lib_path)
|
10
|
+
|
11
|
+
loop do
|
12
|
+
break unless version
|
13
|
+
|
14
|
+
version_dir = File.join(next_dirname, version.segments[0..1].join("."))
|
15
|
+
|
16
|
+
if File.exist?(version_dir)
|
17
|
+
$LOAD_PATH.insert current_index, version_dir
|
18
|
+
current_index += 1
|
19
|
+
end
|
20
|
+
|
21
|
+
version = RubyNext.next_version(version)
|
22
|
+
end
|
data/lib/ruby-next/version.rb
CHANGED
data/lib/uby-next.rb
CHANGED
@@ -43,11 +43,14 @@ at_exit do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
if $0 == "-e" && e_script.nil?
|
46
|
-
|
46
|
+
if File.file?("/proc/self/cmdline")
|
47
|
+
File.read("/proc/self/cmdline")
|
48
|
+
else
|
49
|
+
`ps axw`.split("\n").find { |ps| ps[/\A\s*#{$$}/] }
|
50
|
+
end.then do |command|
|
47
51
|
next unless command
|
48
|
-
command.
|
49
|
-
command.
|
50
|
-
command.match(/\-e(.*)/m)
|
52
|
+
command.gsub!(/(\\012|\u0000)/, "\n")
|
53
|
+
command.match(/-e(.*)/m)
|
51
54
|
end.then do |matches|
|
52
55
|
next unless matches
|
53
56
|
|
@@ -63,6 +66,7 @@ at_exit do
|
|
63
66
|
|
64
67
|
if e_script
|
65
68
|
new_e_script = RubyNext::Language::Runtime.transform(e_script)
|
69
|
+
RubyNext.debug_source new_e_script, $0
|
66
70
|
TOPLEVEL_BINDING.eval(new_e_script, $0)
|
67
71
|
exit!(0)
|
68
72
|
end
|
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.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-next-parser
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unparser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.4.
|
33
|
+
version: 0.4.8
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.4.
|
40
|
+
version: 0.4.8
|
41
41
|
description: "\n Ruby Next Core is a zero deps version of Ruby Next meant to be
|
42
42
|
used\n as as dependency in your gems.\n\n It contains all the polyfills and
|
43
43
|
utility files but doesn't require transpiler\n dependencies to be install.\n
|
@@ -55,6 +55,13 @@ files:
|
|
55
55
|
- bin/parse
|
56
56
|
- bin/ruby-next
|
57
57
|
- bin/transform
|
58
|
+
- lib/.rbnext/2.3/ruby-next/commands/core_ext.rb
|
59
|
+
- lib/.rbnext/2.3/ruby-next/commands/nextify.rb
|
60
|
+
- lib/.rbnext/2.3/ruby-next/language/eval.rb
|
61
|
+
- lib/.rbnext/2.3/ruby-next/language/rewriters/base.rb
|
62
|
+
- lib/.rbnext/2.3/ruby-next/language/rewriters/endless_range.rb
|
63
|
+
- lib/.rbnext/2.3/ruby-next/language/rewriters/pattern_matching.rb
|
64
|
+
- lib/.rbnext/2.3/ruby-next/utils.rb
|
58
65
|
- lib/ruby-next.rb
|
59
66
|
- lib/ruby-next/cli.rb
|
60
67
|
- lib/ruby-next/commands/base.rb
|
@@ -69,6 +76,7 @@ files:
|
|
69
76
|
- lib/ruby-next/core/enumerable/tally.rb
|
70
77
|
- lib/ruby-next/core/enumerator/produce.rb
|
71
78
|
- lib/ruby-next/core/hash/deconstruct_keys.rb
|
79
|
+
- lib/ruby-next/core/hash/except.rb
|
72
80
|
- lib/ruby-next/core/hash/merge.rb
|
73
81
|
- lib/ruby-next/core/kernel/then.rb
|
74
82
|
- lib/ruby-next/core/proc/compose.rb
|
@@ -92,17 +100,22 @@ files:
|
|
92
100
|
- lib/ruby-next/language/rewriters/base.rb
|
93
101
|
- lib/ruby-next/language/rewriters/endless_method.rb
|
94
102
|
- lib/ruby-next/language/rewriters/endless_range.rb
|
103
|
+
- lib/ruby-next/language/rewriters/find_pattern.rb
|
95
104
|
- lib/ruby-next/language/rewriters/method_reference.rb
|
96
105
|
- lib/ruby-next/language/rewriters/numbered_params.rb
|
97
106
|
- lib/ruby-next/language/rewriters/pattern_matching.rb
|
98
107
|
- lib/ruby-next/language/rewriters/right_hand_assignment.rb
|
99
108
|
- lib/ruby-next/language/rewriters/runtime.rb
|
100
109
|
- lib/ruby-next/language/rewriters/runtime/dir.rb
|
110
|
+
- lib/ruby-next/language/rewriters/safe_navigation.rb
|
111
|
+
- lib/ruby-next/language/rewriters/shorthand_hash.rb
|
112
|
+
- lib/ruby-next/language/rewriters/squiggly_heredoc.rb
|
101
113
|
- lib/ruby-next/language/runtime.rb
|
102
114
|
- lib/ruby-next/language/setup.rb
|
103
115
|
- lib/ruby-next/language/unparser.rb
|
104
116
|
- lib/ruby-next/logging.rb
|
105
117
|
- lib/ruby-next/rubocop.rb
|
118
|
+
- lib/ruby-next/setup_self.rb
|
106
119
|
- lib/ruby-next/utils.rb
|
107
120
|
- lib/ruby-next/version.rb
|
108
121
|
- lib/uby-next.rb
|
@@ -123,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
136
|
requirements:
|
124
137
|
- - ">="
|
125
138
|
- !ruby/object:Gem::Version
|
126
|
-
version: 2.
|
139
|
+
version: 2.2.0
|
127
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
141
|
requirements:
|
129
142
|
- - ">="
|