зеркало из https://github.com/github/ruby.git
Fix indents in NEWS [ci skip]
The MarkDown parser in RDoc requires 4 columns indentation for paragraphs following list items.
This commit is contained in:
Родитель
addb1cbbfd
Коммит
4ab89d57bb
160
NEWS.md
160
NEWS.md
|
@ -23,13 +23,13 @@ Note that each entry is kept to a minimum, see links for details.
|
||||||
* A proc that accepts a single positional argument and keywords will
|
* A proc that accepts a single positional argument and keywords will
|
||||||
no longer autosplat. [[Bug #18633]]
|
no longer autosplat. [[Bug #18633]]
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
proc{|a, **k| a}.call([1, 2])
|
proc{|a, **k| a}.call([1, 2])
|
||||||
# Ruby 3.1 and before
|
# Ruby 3.1 and before
|
||||||
# => 1
|
# => 1
|
||||||
# Ruby 3.2 and after
|
# Ruby 3.2 and after
|
||||||
# => [1, 2]
|
# => [1, 2]
|
||||||
```
|
```
|
||||||
|
|
||||||
* Constant assignment evaluation order for constants set on explicit
|
* Constant assignment evaluation order for constants set on explicit
|
||||||
objects has been made consistent with single attribute assignment
|
objects has been made consistent with single attribute assignment
|
||||||
|
@ -39,22 +39,22 @@ Note that each entry is kept to a minimum, see links for details.
|
||||||
foo::BAR = baz
|
foo::BAR = baz
|
||||||
```
|
```
|
||||||
|
|
||||||
`foo` is now called before `baz`. Similarly, for multiple assignments
|
`foo` is now called before `baz`. Similarly, for multiple assignments
|
||||||
to constants, left-to-right evaluation order is used. With this
|
to constants, left-to-right evaluation order is used. With this
|
||||||
code:
|
code:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
foo1::BAR1, foo2::BAR2 = baz1, baz2
|
foo1::BAR1, foo2::BAR2 = baz1, baz2
|
||||||
```
|
```
|
||||||
|
|
||||||
The following evaluation order is now used:
|
The following evaluation order is now used:
|
||||||
|
|
||||||
1. `foo1`
|
1. `foo1`
|
||||||
2. `foo2`
|
2. `foo2`
|
||||||
3. `baz1`
|
3. `baz1`
|
||||||
4. `baz2`
|
4. `baz2`
|
||||||
|
|
||||||
[[Bug #15928]]
|
[[Bug #15928]]
|
||||||
|
|
||||||
* Find pattern is no longer experimental.
|
* Find pattern is no longer experimental.
|
||||||
[[Feature #18585]]
|
[[Feature #18585]]
|
||||||
|
@ -111,10 +111,10 @@ Note: We're only listing outstanding class updates.
|
||||||
`IO::TimeoutError` to be raised if a blocking operation exceeds the
|
`IO::TimeoutError` to be raised if a blocking operation exceeds the
|
||||||
specified timeout. [[Feature #18630]]
|
specified timeout. [[Feature #18630]]
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
STDIN.timeout = 1
|
STDIN.timeout = 1
|
||||||
STDIN.read # => Blocking operation timed out! (IO::TimeoutError)
|
STDIN.read # => Blocking operation timed out! (IO::TimeoutError)
|
||||||
```
|
```
|
||||||
|
|
||||||
* UNIXSocket
|
* UNIXSocket
|
||||||
* Add support for `UNIXSocket` on Windows. Emulate anonymous sockets. Add
|
* Add support for `UNIXSocket` on Windows. Emulate anonymous sockets. Add
|
||||||
|
@ -127,14 +127,14 @@ Note: We're only listing outstanding class updates.
|
||||||
receiver is not a singleton class.
|
receiver is not a singleton class.
|
||||||
[[Feature #12084]]
|
[[Feature #12084]]
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class Foo; end
|
class Foo; end
|
||||||
|
|
||||||
Foo.singleton_class.attached_object #=> Foo
|
Foo.singleton_class.attached_object #=> Foo
|
||||||
Foo.new.singleton_class.attached_object #=> #<Foo:0x000000010491a370>
|
Foo.new.singleton_class.attached_object #=> #<Foo:0x000000010491a370>
|
||||||
Foo.attached_object #=> TypeError: `Foo' is not a singleton class
|
Foo.attached_object #=> TypeError: `Foo' is not a singleton class
|
||||||
nil.singleton_class.attached_object #=> TypeError: `NilClass' is not a singleton class
|
nil.singleton_class.attached_object #=> TypeError: `NilClass' is not a singleton class
|
||||||
```
|
```
|
||||||
|
|
||||||
* Data
|
* Data
|
||||||
* New core class to represent simple immutable value object. The class is
|
* New core class to represent simple immutable value object. The class is
|
||||||
|
@ -194,53 +194,53 @@ Note: We're only listing outstanding class updates.
|
||||||
* Add `error_tolerant` option for `parse`, `parse_file` and `of`. [[Feature #19013]]
|
* Add `error_tolerant` option for `parse`, `parse_file` and `of`. [[Feature #19013]]
|
||||||
With this option
|
With this option
|
||||||
|
|
||||||
1. SyntaxError is suppressed
|
1. SyntaxError is suppressed
|
||||||
2. AST is returned for invalid input
|
2. AST is returned for invalid input
|
||||||
3. `end` is complemented when a parser reachs to the end of input but `end` is insufficient
|
3. `end` is complemented when a parser reachs to the end of input but `end` is insufficient
|
||||||
4. `end` is treated as keyword based on indent
|
4. `end` is treated as keyword based on indent
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# Without error_tolerant option
|
# Without error_tolerant option
|
||||||
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY)
|
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY)
|
||||||
def m
|
def m
|
||||||
a = 10
|
a = 10
|
||||||
if
|
if
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
# => <internal:ast>:33:in `parse': syntax error, unexpected `end' (SyntaxError)
|
# => <internal:ast>:33:in `parse': syntax error, unexpected `end' (SyntaxError)
|
||||||
|
|
||||||
# With error_tolerant option
|
# With error_tolerant option
|
||||||
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY, error_tolerant: true)
|
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY, error_tolerant: true)
|
||||||
def m
|
def m
|
||||||
a = 10
|
a = 10
|
||||||
if
|
if
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
p root # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-4:3>
|
p root # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-4:3>
|
||||||
|
|
||||||
# `end` is treated as keyword based on indent
|
# `end` is treated as keyword based on indent
|
||||||
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY, error_tolerant: true)
|
root = RubyVM::AbstractSyntaxTree.parse(<<~RUBY, error_tolerant: true)
|
||||||
module Z
|
module Z
|
||||||
class Foo
|
class Foo
|
||||||
foo.
|
foo.
|
||||||
end
|
end
|
||||||
|
|
||||||
def bar
|
def bar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
p root.children[-1].children[-1].children[-1].children[-2..-1]
|
p root.children[-1].children[-1].children[-1].children[-2..-1]
|
||||||
# => [#<RubyVM::AbstractSyntaxTree::Node:CLASS@2:2-4:5>, #<RubyVM::AbstractSyntaxTree::Node:DEFN@6:2-7:5>]
|
# => [#<RubyVM::AbstractSyntaxTree::Node:CLASS@2:2-4:5>, #<RubyVM::AbstractSyntaxTree::Node:DEFN@6:2-7:5>]
|
||||||
```
|
```
|
||||||
|
|
||||||
* Add `keep_tokens` option for `parse`, `parse_file` and `of`. Add `#tokens` and `#all_tokens`
|
* Add `keep_tokens` option for `parse`, `parse_file` and `of`. Add `#tokens` and `#all_tokens`
|
||||||
for `RubyVM::AbstractSyntaxTree::Node` [[Feature #19070]]
|
for `RubyVM::AbstractSyntaxTree::Node` [[Feature #19070]]
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true)
|
root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true)
|
||||||
root.tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
|
root.tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
|
||||||
root.tokens.map{_1[2]}.join # => "x = 1 + 2"
|
root.tokens.map{_1[2]}.join # => "x = 1 + 2"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Set
|
* Set
|
||||||
* Set is now available as a built-in class without the need for `require "set"`. [[Feature #16989]]
|
* Set is now available as a built-in class without the need for `require "set"`. [[Feature #16989]]
|
||||||
|
@ -280,11 +280,11 @@ Note: We're only listing outstanding class updates.
|
||||||
## Stdlib updates
|
## Stdlib updates
|
||||||
|
|
||||||
* ERB
|
* ERB
|
||||||
* `-S` option is removed from `erb` command.
|
* `-S` option is removed from `erb` command.
|
||||||
|
|
||||||
* SyntaxSuggest
|
* SyntaxSuggest
|
||||||
* The feature of `syntax_suggest` formerly `dead_end` is integrated in Ruby.
|
* The feature of `syntax_suggest` formerly `dead_end` is integrated in Ruby.
|
||||||
[[Feature #18159]]
|
[[Feature #18159]]
|
||||||
|
|
||||||
* The following default gems are updated.
|
* The following default gems are updated.
|
||||||
* RubyGems 3.4.0.dev
|
* RubyGems 3.4.0.dev
|
||||||
|
@ -364,20 +364,20 @@ The following deprecated methods are removed.
|
||||||
Users need to install the libyaml/libffi library themselves via the package
|
Users need to install the libyaml/libffi library themselves via the package
|
||||||
manager like apt, yum, brew, etc.
|
manager like apt, yum, brew, etc.
|
||||||
|
|
||||||
Psych and fiddle supported the static build with specific version of libyaml
|
Psych and fiddle supported the static build with specific version of libyaml
|
||||||
and libffi sources. You can build psych with libyaml-0.2.5 like this.
|
and libffi sources. You can build psych with libyaml-0.2.5 like this.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./configure --with-libyaml-source-dir=/path/to/libyaml-0.2.5
|
$ ./configure --with-libyaml-source-dir=/path/to/libyaml-0.2.5
|
||||||
```
|
```
|
||||||
|
|
||||||
And you can build fiddle with libffi-3.4.4 like this.
|
And you can build fiddle with libffi-3.4.4 like this.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./configure --with-libffi-source-dir=/path/to/libffi-3.4.4
|
$ ./configure --with-libffi-source-dir=/path/to/libffi-3.4.4
|
||||||
```
|
```
|
||||||
|
|
||||||
[[Feature #18571]]
|
[[Feature #18571]]
|
||||||
|
|
||||||
## C API updates
|
## C API updates
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче