ruby-next-core 0.2.0 → 0.3.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 +26 -0
- data/README.md +69 -7
- data/bin/ruby-next +1 -1
- data/lib/ruby-next/cli.rb +45 -6
- data/lib/ruby-next/commands/core_ext.rb +166 -0
- data/lib/ruby-next/commands/nextify.rb +18 -3
- data/lib/ruby-next/core.rb +149 -1
- data/lib/ruby-next/core/array/deconstruct.rb +21 -0
- data/lib/ruby-next/core/array/difference_union_intersection.rb +15 -21
- data/lib/ruby-next/core/constants/no_matching_pattern_error.rb +17 -0
- data/lib/ruby-next/core/enumerable/filter.rb +20 -18
- data/lib/ruby-next/core/enumerable/filter_map.rb +28 -40
- data/lib/ruby-next/core/enumerable/tally.rb +9 -23
- data/lib/ruby-next/core/enumerator/produce.rb +12 -14
- data/lib/ruby-next/core/hash/deconstruct_keys.rb +21 -0
- data/lib/ruby-next/core/hash/merge.rb +8 -10
- data/lib/ruby-next/core/kernel/then.rb +7 -9
- data/lib/ruby-next/core/proc/compose.rb +12 -14
- data/lib/ruby-next/core/string/split.rb +11 -0
- data/lib/ruby-next/core/struct/deconstruct.rb +7 -0
- data/lib/ruby-next/core/struct/deconstruct_keys.rb +34 -0
- data/lib/ruby-next/core/time/ceil.rb +10 -0
- data/lib/ruby-next/core/time/floor.rb +9 -0
- data/lib/ruby-next/core/unboundmethod/bind_call.rb +9 -0
- data/lib/ruby-next/core_ext.rb +18 -0
- data/lib/ruby-next/language.rb +4 -2
- data/lib/ruby-next/language/parser.rb +5 -1
- data/lib/ruby-next/language/rewriters/base.rb +2 -2
- data/lib/ruby-next/language/rewriters/method_reference.rb +3 -1
- data/lib/ruby-next/language/rewriters/numbered_params.rb +2 -2
- data/lib/ruby-next/language/rewriters/pattern_matching.rb +36 -17
- data/lib/ruby-next/language/runtime.rb +2 -3
- data/lib/ruby-next/version.rb +1 -1
- metadata +13 -3
- data/lib/ruby-next/core/pattern_matching.rb +0 -37
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.3.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-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -58,18 +58,28 @@ files:
|
|
58
58
|
- lib/ruby-next.rb
|
59
59
|
- lib/ruby-next/cli.rb
|
60
60
|
- lib/ruby-next/commands/base.rb
|
61
|
+
- lib/ruby-next/commands/core_ext.rb
|
61
62
|
- lib/ruby-next/commands/nextify.rb
|
62
63
|
- lib/ruby-next/core.rb
|
64
|
+
- lib/ruby-next/core/array/deconstruct.rb
|
63
65
|
- lib/ruby-next/core/array/difference_union_intersection.rb
|
66
|
+
- lib/ruby-next/core/constants/no_matching_pattern_error.rb
|
64
67
|
- lib/ruby-next/core/enumerable/filter.rb
|
65
68
|
- lib/ruby-next/core/enumerable/filter_map.rb
|
66
69
|
- lib/ruby-next/core/enumerable/tally.rb
|
67
70
|
- lib/ruby-next/core/enumerator/produce.rb
|
71
|
+
- lib/ruby-next/core/hash/deconstruct_keys.rb
|
68
72
|
- lib/ruby-next/core/hash/merge.rb
|
69
73
|
- lib/ruby-next/core/kernel/then.rb
|
70
|
-
- lib/ruby-next/core/pattern_matching.rb
|
71
74
|
- lib/ruby-next/core/proc/compose.rb
|
72
75
|
- lib/ruby-next/core/runtime.rb
|
76
|
+
- lib/ruby-next/core/string/split.rb
|
77
|
+
- lib/ruby-next/core/struct/deconstruct.rb
|
78
|
+
- lib/ruby-next/core/struct/deconstruct_keys.rb
|
79
|
+
- lib/ruby-next/core/time/ceil.rb
|
80
|
+
- lib/ruby-next/core/time/floor.rb
|
81
|
+
- lib/ruby-next/core/unboundmethod/bind_call.rb
|
82
|
+
- lib/ruby-next/core_ext.rb
|
73
83
|
- lib/ruby-next/language.rb
|
74
84
|
- lib/ruby-next/language/bootsnap.rb
|
75
85
|
- lib/ruby-next/language/eval.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
unless defined?(NoMatchingPatternError)
|
4
|
-
class NoMatchingPatternError < RuntimeError
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
# Add `#deconstruct` and `#deconstruct_keys` to core classes
|
9
|
-
unless [].respond_to?(:deconstruct)
|
10
|
-
RubyNext.module_eval do
|
11
|
-
refine Array do
|
12
|
-
def deconstruct
|
13
|
-
self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
refine Struct do
|
18
|
-
alias deconstruct to_a
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
unless {}.respond_to?(:deconstruct_keys)
|
24
|
-
RubyNext.module_eval do
|
25
|
-
refine Hash do
|
26
|
-
def deconstruct_keys(_)
|
27
|
-
self
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
refine Struct do
|
32
|
-
def deconstruct_keys(_)
|
33
|
-
to_h
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|