NEWS for Ruby 2.6.0

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.$FEATURE_OR_BUG_NUMBER)

Changes since the 2.5.0 release

Language changes

Core classes updates (outstanding ones only)

New methods
Modified method
  • Array#to_h now accepts a block that maps elements to new key/value pairs. [Feature #15143]

Aliased methods
New method
  • Added Binding#source_location. [Feature #14230]

    This method returns the source location of the binding, a 2-element array of __FILE__ and __LINE__. Traditionally, the same information could be retrieved by eval("[__FILE__, __LINE__]", binding), but we are planning to change this behavior so that Kernel#eval ignores binding’s source location [Bug #4352]. So, users should use this newly-introduced method instead of Kernel#eval.

New methods
New method
  • Enumerable#chain returns an enumerator object that iterates over the elements of the receiver and then those of each argument in sequence. [Feature #15144]

Modified method
  • Enumerable#to_h now accepts a block that maps elements to new key/value pairs. [Feature #15143]

Aliased method
  • This is a new class to represent a generator of an arithmetic sequence, that is a number sequence defined by a common difference. It can be used for representing what is similar to Python’s slice. You can get an instance of this class from Numeric#step and Range#step.

  • This is a new class to represent a chain of enumerables that works as a single enumerator, generated by such methods as Enumerable#chain and Enumerator#+.

Aliased method
New methods
  • Enumerator#+ returns an enumerator object that iterates over the elements of the receiver and then those of the other operand. [Feature #15144]

Modified method
  • ENV.to_h now accepts a block that maps names and values to new keys and values. [Feature #15143]

New options
Modified methods
Aliased methods
New option
  • Added new mode character 'x' to open files for exclusive access. [Feature #11258]

Aliased method
New options
Incompatible changes
  • Kernel#system and Kernel#exec do not close non-standard file descriptors (the default of the :close_others option is changed to false, but we still set the FD_CLOEXEC flag on descriptors we create). [Misc #14907]

New options
  • accepts :receiver and :key options to set receiver and key in Ruby code. [Feature #14313]

New methods
Modified methods
New option
  • accepts a :receiver option to set receiver in Ruby code. [Feature #14313]

New method
  • NilClass#=~ is added for compatibility. [Feature #15231]

New option
  • accepts a :receiver option to set receiver in Ruby code. [Feature #14313]

Incompatible changes
Modified method
  • OpenStruct#to_h now accepts a block that maps keys and values to new keys and values. [Feature #15143]

New methods
Incompatible changes
  • Proc#call doesn’t change $SAFE any more. [Feature #14250]

New method
New method
  • Added Range#% instance method. [Feature #14697]

Incompatible changes
  • Update Unicode version from 10.0.0 to 11.0.0. [Feature #14802]

    This includes a rewrite of the grapheme cluster (/X/) algorithm and special-casing for Georgian MTAVRULI on String#downcase.

  • Update Emoji version from 5.0 to 11.0.0 [Feature #14802]

New methods
New method
  • RubyVM.resolve_feature_path identifies the file that will be loaded by “require(feature)”. [experimental] [Feature #15230]

New features
  • String#split yields each substring to the block if given. [Feature #4780]

Modified method
  • Struct#to_h now accepts a block that maps keys and values to new keys and values. [Feature #15143]

Aliased method
New features
New features
  • “script_compiled” event is supported. [Feature #15287]

New methods
Modified method
  • TracePoint#enable accepts new keywords “target:” and “target_line:”. [Feature #15289]

Stdlib updates (outstanding ones only)


Update to version 1.4.0. This version includes several compatibility issues, see Compatibility issues section below for details.

Modified method
  • BigDecimal() accepts the new keyword “exception:” similar to Float().

Note for the differences among recent versions

You should want to know the differences among recent versions of bigdecimal. Please select the suitable version of bigdecimal according to the following information.

  • 1.3.5 has without “exception:” keyword. You can see the deprecation warning of when you specify “-w” option. BigDecimal(),, and Object#to_d methods are the same.

  • 1.4.0 has with “exception:” keyword. You always see the deprecation warning of Object#to_d method is different from BigDecimal() and

  • 2.0.0 will be released soon after releasing Ruby 2.6.0. This version will not have the method.

  • Add Bundler to Standard Library. [Feature #12733]

  • Use 1.17.2, the latest stable version.


A oneshot_lines mode is added. [Feature #15022]

This mode checks “whether each line was executed at least once or not”, instead of “how many times each line was executed”. A hook for each line is fired at most once, and after it is fired the hook flag is removed, i.e., it runs with zero overhead.

New options
  • Add :oneshot_lines keyword argument to Coverage.start.

  • Add :stop and :clear keyword arguments to Coverage.result. If clear is true, it clears the counters to zero. If stop is true, it disables coverage measurement.

New methods
  • Coverage.line_stub, which is a simple helper function that creates the “stub” of line coverage from a given source code.

New options
  • Add :trim_mode and :eoutvar keyword arguments to Now non-keyword arguments other than the first one are softly deprecated and will be removed when Ruby 2.5 becomes EOL. [Feature #14256]

  • erb command’s -S option is deprecated, and will be removed in the next version.

New methods
  • FileUtils#cp_lr. [Feature #4189]

New methods
  • Matrix#antisymmetric?, Matrix#skew_symmetric?

  • Matrix#map!, Matrix#collect! [Feature #14151]

  • Matrix#[]=

  • Vector#map!, Vector#collect!

  • Vector#[]=

New options
  • Add :write_timeout keyword argument to [Feature #13396]

New methods
  • Add Net::HTTP#write_timeout and Net::HTTP#write_timeout=. [Feature #13396]

New constant
  • Add Net::HTTPClientException to deprecate Net::HTTPServerException, whose name is misleading. [Bug #14688]

  • Upgrade to nkf v2.1.5

  • Upgrade to Psych 3.1.0

  • Become about 2 times faster.

  • Use SOURCE_DATE_EPOCH to generate files.

  • Fix method line number that slipped off.

  • Enable --width, --exclude, and --line-numbers that were ignored.

  • Add support for blockquote by “>>>” in default markup notation.

  • Add support for “Raises” lines in TomDoc notation.

  • Fix syntax error output.

  • Fix many parsing bugs.

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: Fix function(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

New options
  • RSS::Parser.parse now accepts options as Hash. :validate , :ignore_unknown_element , :parser_class options are available.

Aliased method
  • Set#filter! is a new alias for Set#select!. [Feature #13784]

New constant
  • Add URI::File to handle the file URI scheme. [Feature #14035]

Compatibility issues (excluding feature bug fixes)

  • Dir.glob with '\0'-separated pattern list will be deprecated, and is now warned. [Feature #14643]

  • Object#=~ is deprecated. [Feature #15231]

Stdlib compatibility issues (excluding feature bug fixes)

  • The following methods are removed.

    • BigDecimal.allocate

    • BigDecimal.ver

  • Every BigDecimal object is frozen. [Feature #13984]

  • BigDecimal() parses the given string similar to Float().

  • String#to_d parses the receiver string similar to String#to_f.

  • will be removed in version 2.0.

  • Pathname#read, Pathname#binread, Pathname#write, Pathname#binwrite, Pathname#each_line and Pathname#readlines do not invoke external commands even if the path starts with the pipe character '|'. This follows [Feature #14245].

Implementation improvements

Miscellaneous changes