You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Passing an empty keyword splat to a method that does not accept keywords
123
123
no longer passes an empty hash, unless the empty hash is necessary for
124
124
a required parameter, in which case a warning will be emitted. Remove
125
125
the double splat to continue passing a positional hash. [[Feature #14183]](https://bugs.ruby-lang.org/issues/14183)
126
126
127
-
```ruby
128
-
h = {}; deffoo(*a) a end; foo(**h) # []
129
-
h = {}; deffoo(a) a end; foo(**h) # {} and warning
130
-
h = {}; deffoo(*a) a end; foo(h) # [{}]
131
-
h = {}; deffoo(a) a end; foo(h) # {}
132
-
```
127
+
```ruby
128
+
h = {}; deffoo(*a) a end; foo(**h) # []
129
+
h = {}; deffoo(a) a end; foo(**h) # {} and warning
130
+
h = {}; deffoo(*a) a end; foo(h) # [{}]
131
+
h = {}; deffoo(a) a end; foo(h) # {}
132
+
```
133
133
134
134
## Other Notable New Features
135
135
@@ -140,36 +140,36 @@ deprecated, and conversion will be removed in Ruby 3. [[Feature #14183]](https:
140
140
* A beginless range is experimentally introduced. It might not be as useful
141
141
as an endless range, but would be good for DSL purpose. [[Feature #14799]](https://bugs.ruby-lang.org/issues/14799)
142
142
143
-
```ruby
144
-
ary[..3] # identical to ary[0..3]
145
-
rel.where(sales: ..100)
146
-
```
143
+
```ruby
144
+
ary[..3] # identical to ary[0..3]
145
+
rel.where(sales: ..100)
146
+
```
147
147
148
148
* `Enumerable#tally` is added. It counts the occurrence of each element.
149
149
150
-
```ruby
151
-
["a", "b", "c", "b"].tally
152
-
#=> {"a"=>1, "b"=>2, "c"=>1}
153
-
```
150
+
```ruby
151
+
["a", "b", "c", "b"].tally
152
+
#=> {"a"=>1, "b"=>2, "c"=>1}
153
+
```
154
154
155
155
*Calling a private method on `self` is now allowed. [[Feature#11297]](https://bugs.ruby-lang.org/issues/11297) [[Feature #16123]](https://bugs.ruby-lang.org/issues/16123)
156
156
157
-
```ruby
158
-
def foo
159
-
end
160
-
private :foo
161
-
self.foo
162
-
```
157
+
```ruby
158
+
def foo
159
+
end
160
+
private :foo
161
+
self.foo
162
+
```
163
163
164
164
*`Enumerator::Lazy#eager` is added. It generates a non-lazy enumerator
165
165
from a lazy enumerator. [Feature#15901]
166
166
167
-
```ruby
168
-
a = %w(foo bar baz)
169
-
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
170
-
p e.class #=> Enumerator
171
-
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
172
-
```
167
+
```ruby
168
+
a = %w(foo bar baz)
169
+
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
170
+
p e.class #=> Enumerator
171
+
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
0 commit comments