This document is a list of user visible feature changes made between releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or reference
information is supplied with. For a full list of changes with all
sufficient information, see the ChangeLog file or Redmine
(e.g. https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER)
-
$SAFEis a process global state and we can set 0 again. [Feature #14250] -
refinements take place at block passing. [Feature #14223]
-
elsewithoutrescuenow causes a syntax error. [EXPERIMENTAL] -
constant names may start with a non-ASCII capital letter. [Feature #13770]
-
An endless range is introduced. You can write a range that has no end, like
(0..). The following shows typical use cases. [Feature #12912]ary[1..] # identical to ary[1..-1] (1..).each {|index| ... } # infinite loop from index 1 ary.zip(1..) {|elem, index| ... } # ary.each.with_index(1) { }
-
Non-
Symbolkey in keyword arguments hash causes an exception.
-
Array-
Aliased methods:
Array#filteris a new alias forArray#select. [Feature #13784]Array#filter!is a new alias forArray#select!. [Feature #13784]
-
-
Binding-
New methods:
-
added
Binding#source_location. [Feature #14230]This method returns the source location of binding, a 2-element array of
__FILE__and__LINE__. Traditionally, the same information could be retrieved byeval("[__FILE__, __LINE__]", binding), but we are planning to change this behavior so thatKernel#evalignores binding's source location [Bug #4352]. So, users should use this newly-introduced method instead ofKernel#eval.
-
-
-
Dir-
New methods:
- added
Dir#each_childandDir#childreninstance methods. [Feature #13969]
- added
-
-
Enumerable-
Aliased methods:
Enumerable#filteris a new alias forEnumerable#select. [Feature #13784]
-
-
Enumerator::Lazy-
Aliased methods:
Enumerator::Lazy#filteris a new alias forEnumerator::Lazy#select. [Feature #13784]
-
-
Exception-
New options:
Exception#full_messagetakes:highlightand:orderoptions. [Bug #14324]
-
-
Hash-
Aliased methods:
-
Hash#filteris a new alias forHash#select. [Feature #13784] -
Hash#filter!is a new alias forHash#select!. [Feature #13784]
-
-
-
IO-
New options:
- new mode character
'x'to open files for exclusive access. [Feature #11258]
- new mode character
-
-
Kernel-
Aliased methods:
Kernel#thenis a new alias forKernel#yield_self. [Feature #14594]
-
New options:
-
Kernel.#Complex,Kernel.#Float,Kernel.#IntegerandKernel.#Rationaltake:exceptionoption to specify the way of error handling. [Feature #12732] -
Kernel.#systemtakes:exceptionoption to raise an exception on failure. [Feature #14386]
-
-
Incompatible changes:
system()andexec()do not close non-standard file descriptors (The default of:close_othersoption is changed tofalseby default. but we still set theFD_CLOEXECflag on descriptors we create). [Misc #14907]
-
-
KeyError-
New options:
KeyError#initializeaccepts:receiverand:keyoptions to set receiver and key in Ruby code. [Feature #14313]
-
-
Module-
New methods:
Module#method_defined?,Module#private_method_defined?andModule#protected_method_defined?now accepts the second parameter as optional. If it'strue(=default), checks ancestor modules/classes, or checks only the class itself. [Feature #14944]
-
-
NameError-
New options:
NameError#initializeaccepts:receiveroption to set receiver in Ruby code. [Feature #14313]
-
-
NoMethodError-
New options:
NoMethodError#initializeaccepts:receiveroption to set receiver in Ruby code. [Feature #14313]
-
-
Proc-
Incompatible changes:
Proc#calldoesn't change$SAFEany more. [Feature #14250]
-
-
Random-
New methods:
- added
Random.bytes. [Feature #4938]
- added
-
-
Range-
Incompatible changes:
Range#===now uses#cover?instead of#include?method. [Feature #14575]
-
-
RubyVM::AST-
New methods:
-
RubyVM::AST.parseparses a given string and returns AST nodes. [experimental] -
RubyVM::AST.parse_fileparses a given file and returns AST nodes. [experimental]
-
-
-
String-
New features:
String#splityields each substring to the block if given. [Feature #4780]
-
-
TracePoint-
New methods:
TracePoint#parameters[Feature #14694]
-
-
ERB-
New options:
-
Add
:trim_modeand:eoutvarkeyword arguments toERB.new. Now non-keyword arguments other than first one are softly deprecated and will be removed when Ruby 2.5 becomes EOL. [Feature #14256] -
erb command's
-Soption is deprecated, which will be removed in the next version.
-
-
-
FileUtils-
New method:
FileUtils#cp_lr. [Feature #4189]
-
-
Matrix-
New method:
Matrix#antisymmetric?
-
-
Net-
New options:
- Add
:write_timeoutkeyword argument toNet::BufferedIO.new. [Feature #13396]
- Add
-
New methods:
- Add
Net::BufferedIO#write_timeout,Net::BufferedIO#write_timeout=,Net::HTTP#write_timeout, andNet::HTTP#write_timeout=. [Feature #13396]
- Add
-
New constant:
- Add
Net::HTTPClientExceptionto deprecateNet::HTTPServerException, whose name is misleading. [Bug #14688]
- Add
-
-
REXML-
Improved some XPath implementations:
-
concat()function: Stringify all arguments before concatenating -
string()function: Support context node -
string()function: Support processing instruction node -
Support
"*:#{ELEMENT_NAME}"syntax in XPath 2.0
-
-
Fixed some XPath implementations:
-
"//#{ELEMENT_NAME}[#{POSITION}]"case -
string()function: Fixfunction(document)returns nodes that are out of root elements. -
"/ #{ELEMENT_NAME} "case -
"/ #{ELEMENT_NAME} [ #{PREDICATE} ]"case -
"/ #{AXIS}:: #{ELEMENT_NAME} "case -
"#{N}-#{M}"case: One or more white spaces were required before"-" -
"/child::node()"case -
"#{FUNCTION}()/#{PATH}"case -
"@#{ATTRIBUTE}/parent::"case -
"name(#{NODE_SET})"case
-
-
-
RSS-
New options:
RSS::Parser.parse: Accept options asHash.:validate,:ignore_unknown_element,:parser_classoptions are available.
-
-
Set-
Aliased methods:
Set#filter!is a new alias forSet#select!. [Feature #13784]
-
-
URI-
New constant:
- Add
URI::Fileto handle file URI scheme. [Feature #14035]
- Add
-
-
FileFile.read,File.binread,File.write,File.binwrite,File.foreach, andFile.readlinesdo not invoke external commands even if the path starts with the pipe character'|'. [Feature #14245]
-
DirDir.globwith'\0'-separated pattern list will be deprecated, and is now warned. [Feature #14643]
-
Speedup
Proc#callbecause we don't need to care about$SAFEany more. [Feature #14318]With
lc_fizzbuzzbenchmark which uses so manyProc#callwe can measure x1.4 improvements. [Bug #10212] -
Speedup
block.callwhereblockis passed block parameter. [Feature #14330]Ruby 2.5 improves block passing performance. [Feature #14045]
Additionally, Ruby 2.6 improves the performance of passed block calling.
-
Introduce an initial implementation of JIT (Just-in-time) compiler. [Feature #14235] [experimental]
--jitoption is added to enable JIT.--jit-verbose=1is good for inspection. Seeruby --helpfor others.- This JIT relies on C compiler used to build Ruby, on runtime. Only gcc and clang are supported for the JIT for now, and MinGW support has some issues.
- As of 2.6.0-preview1, we're just preparing infrastructure for JIT and very few optimizations are implemented. So it's not ready for benchmarking Ruby's JIT performance yet. It's known that current JIT enablement makes Rails application slower for now.
-
VM generator script renewal; makes the generated VM more optimized. [GH-1779]
-
Thread cache enabled for pthreads platforms (for
Thread.newandThread.start). [Feature #14757]
-
On macOS, shared libraries no longer include a full version number of ruby in their names. This eliminates the burden of each teeny upgrade on the platform that users need to rebuild every extension library.
-
Before:
- libruby.2.6.0.dylib
- libruby.2.6.dylib -> libruby.2.6.0.dylib
- libruby.dylib -> libruby.2.6.0.dylib
-
After:
- libruby.2.6.dylib
- libruby.dylib -> libruby.2.6.dylib
-