红联Linux门户
Linux帮助

Ruby 2.4.0正式版发布

发布时间:2016-12-24 09:15:05来源:红联作者:baihuo
Ruby 2.4.0 正式版发布了。Ruby 是一门跨平台、面向对象的动态类型编程语言。Ruby 体现了表达的一致性和简单性,它不仅是一门编程语言,更是表达想法的一种简练方式。

此文档是除了错误修复之外的用户可见的功能更改的列表。注意:每个条目保持如此简短,以致不提供背后的原因或参考信息。有关具体所有的完整更改列表,请参阅 ChangeLog 文件或 Redmine。

部分更新内容:

Changes since the 2.3.0 release

Language changes

Multiple assignment in conditional expression is now allowed. [Feature #10617]

Refinements is enabled at method by Symbol#to_proc. [Feature #9451]

Refinements is enabled with Kernel#send and BasicObject#__send__. [Feature #11476]

Rescue modifier now applicable to method arguments. [Feature #12686]

Toplevel return is now allowed. [Feature #4840]

Core classes updates (outstanding ones only)

Array

Array#concat [Feature #12333]

Now takes multiple arguments.

Array#max and Array#min. [Feature #12172]

This may cause a tiny incompatibility: if you redefine Enumerable#max and call max to an Array, your redefinition will be now ignored. You should also redefine Array#max.

Array#pack [Feature #12754]

Now takes optional argument `buffer:' to reuse already allocated buffer.

Array#sum [Feature #12217]

This is different from Enumerable#sum in that Array#sum doesn't depend on the definition of each method.

Comparable

Comparable#clamp. [Feature #10594]

Dir

Dir.empty?. [Feature #10121]

Enumerable

Enumerable#chunk called without a block now return an Enumerator [Feature #2172]

Enumerable#sum [Feature #12217]

Enumerable#uniq [Feature #11090]

Enumerator::Lazy

Enumerator::Lazy#chunk_while [GH-1186]

Enumerator::Lazy#uniq [Feature #11090]

File

File.empty?. [Feature #9969]

Float

Float#ceil, Float#floor, and Float#truncate now take an optional digits, as well as Float#round. [Feature #12245]

Float#round now takes an optional keyword argument, half option, and the default behavior is round-up. [Bug #12548] [Bug #12958]

half option can be one of :even, :up, and :down. [Feature #12953]

Hash

Hash#compact and Hash#compact! [Feature #11818]

Hash#transform_values and Hash#transform_values! [Feature #12512]

Integer

Fixnum and Bignum are unified into Integer [Feature #12005]

Integer#ceil, Integer#floor, and Integer#truncate now take an optional digits, as well as Integer#round. [Feature #12245]

Integer#digits for extracting columns of place-value notation [Feature #12447]

Integer#round now takes an optional keyword argument, half option, and the default behavior is round-up now. [Bug #12548] [Bug #12958]

half option can be one of :even, :up, and :down. [Feature #12953]

IO

IO#gets, IO#readline, IO#each_line, IO#readlines, IO.foreach now takes an optional keyword argument, chomp flag. [Feature #12553]

Kernel

Kernel#clone now takes an optional keyword argument, freeze flag. [Feature #12300]

MatchData

MatchData#named_captures [Feature #11999]

MatchData#values_at supports named captures [Feature #9179]

Module

Module#refine accepts a module as the argument now. [Feature #12534]

Module.used_modules [Feature #7418]

Numeric

Numeric#finite?, Numeric#infinite? [Feature #12039]

Process

Support CLOCK_MONOTONIC_RAW_APPROX, CLOCK_UPTIME_RAW, and CLOCK_UPTIME_RAW_APPROX which are introduced by macOS 10.12.

软件详情:https://github.com/ruby/ruby/releases/tag/v2_4_0

下载地址:https://github.com/ruby/ruby/archive/v2_4_0.zip

来自:开源中国社区
文章评论

共有 0 条评论