2013-02-24 19:44:08 -05:00
|
|
|
# -*- rdoc -*-
|
|
|
|
|
2013-02-24 19:41:07 -05:00
|
|
|
= NEWS for Ruby 2.1.0
|
2008-12-12 04:46:28 -05:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2013-02-24 19:41:07 -05:00
|
|
|
== Changes since the 2.0.0 release
|
2010-09-15 12:14:05 -04:00
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== Language changes
|
2013-08-01 13:33:29 -04:00
|
|
|
|
2013-09-24 20:29:52 -04:00
|
|
|
* Now the default values of keyword arguments can be omitted. Those
|
|
|
|
"required keyword arguments" need giving explicitly at the call time.
|
|
|
|
|
2013-09-02 01:16:39 -04:00
|
|
|
* Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
|
2013-08-01 13:33:29 -04:00
|
|
|
* "42r" and "3.14r" are evaluated as Rational(42, 1) and 3.14.rationalize,
|
|
|
|
respectively. But exponential form with 'r' suffix like "6.022e+23r" is
|
2013-08-01 16:46:01 -04:00
|
|
|
not accepted because it is misleading.
|
|
|
|
* "42i" and "3.14i" are evaluated as Complex(0, 42) and Complex(0, 3.14),
|
2013-08-01 13:33:29 -04:00
|
|
|
respectively.
|
|
|
|
* "42ri" and "3.14ri" are evaluated as Complex(0, 42r) and Complex(0, 3.14r),
|
|
|
|
respectively.
|
|
|
|
|
2013-08-14 01:35:21 -04:00
|
|
|
* def-expr now returns the symbol of its name instead of nil.
|
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== Core classes updates (outstanding ones only)
|
2013-03-10 14:23:00 -04:00
|
|
|
|
2013-10-23 11:10:48 -04:00
|
|
|
* Array
|
|
|
|
* New methods
|
|
|
|
* Array#to_h converts an array of key-value pairs into a Hash.
|
|
|
|
|
2013-08-09 06:14:30 -04:00
|
|
|
* Binding
|
|
|
|
* New methods
|
|
|
|
* Binding#local_variable_get(symbol)
|
2013-08-09 20:21:46 -04:00
|
|
|
* Binding#local_variable_set(symbol, obj)
|
2013-08-09 06:14:30 -04:00
|
|
|
* Binding#local_variable_defined?(symbol)
|
|
|
|
|
2013-10-23 11:10:48 -04:00
|
|
|
* Enumerable
|
|
|
|
* New methods
|
|
|
|
* Enumerable#to_h converts a list of key-value pairs into a Hash.
|
|
|
|
|
2013-11-10 10:18:07 -05:00
|
|
|
* Exception
|
|
|
|
* New methods
|
|
|
|
* Exception#cause provides the previous exception which has been caught
|
|
|
|
at where raising the new exception.
|
|
|
|
|
2013-03-13 22:54:30 -04:00
|
|
|
* GC
|
2013-12-08 04:33:56 -05:00
|
|
|
* improvements:
|
|
|
|
* introduced the generational GC a.k.a RGenGC.
|
|
|
|
* added environment variables:
|
|
|
|
* RUBY_GC_HEAP_INIT_SLOTS
|
|
|
|
* RUBY_GC_HEAP_FREE_SLOTS
|
|
|
|
* RUBY_GC_HEAP_GROWTH_FACTOR
|
|
|
|
* RUBY_GC_HEAP_GROWTH_MAX_SLOTS
|
|
|
|
* RUBY_GC_MALLOC_LIMIT_MAX
|
|
|
|
* RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
|
|
|
|
* RUBY_GC_OLDMALLOC_LIMIT
|
|
|
|
* RUBY_GC_OLDMALLOC_LIMIT_MAX
|
|
|
|
* RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
|
|
|
|
* obsoleted environment variables:
|
|
|
|
* RUBY_FREE_MIN (Use RUBY_GC_HEAP_FREE_SLOTS instead)
|
|
|
|
* RUBY_HEAP_MIN_SLOTS (Use RUBY_GC_HEAP_INIT_SLOTS instead)
|
2013-03-13 22:54:30 -04:00
|
|
|
|
2013-09-27 10:31:56 -04:00
|
|
|
* Integer
|
|
|
|
* New methods
|
|
|
|
* Fixnum#bit_length
|
|
|
|
* Bignum#bit_length
|
|
|
|
* Bignum performance improvement
|
|
|
|
* Use GMP if available.
|
|
|
|
GMP is used only for several operations:
|
|
|
|
multiplication, division, radix conversion, GCD
|
|
|
|
|
2013-04-03 08:25:09 -04:00
|
|
|
* IO
|
|
|
|
* extended methods:
|
2013-08-02 11:13:42 -04:00
|
|
|
* IO#seek supports SEEK_DATA and SEEK_HOLE as whence.
|
|
|
|
* IO#seek accepts symbols (:CUR, :END, :SET, :DATA, :HOLE) for 2nd argument.
|
2013-08-26 18:50:23 -04:00
|
|
|
* IO#read_nonblock accepts optional `exception: false` to return symbols
|
|
|
|
* IO#write_nonblock accepts optional `exception: false` to return symbols
|
2013-04-03 08:25:09 -04:00
|
|
|
|
2013-05-14 04:42:58 -04:00
|
|
|
* Kernel
|
|
|
|
* New methods:
|
|
|
|
* Kernel#singleton_method
|
|
|
|
|
2013-06-14 01:35:11 -04:00
|
|
|
* Module
|
|
|
|
* New methods:
|
|
|
|
* Module#using, which activates refinements of the specified module only
|
|
|
|
in the current class or module definition.
|
2013-08-08 10:01:23 -04:00
|
|
|
* Module#singleton_class? returns true if the receiver is a singleton class
|
|
|
|
or false if it is an ordinary class or module.
|
2013-07-31 05:29:40 -04:00
|
|
|
* extended methods:
|
|
|
|
* Module#refine is no longer experimental.
|
2013-09-04 02:43:05 -04:00
|
|
|
* Module#include and Module#prepend are now public methods.
|
2013-06-14 01:35:11 -04:00
|
|
|
|
2013-03-10 14:23:00 -04:00
|
|
|
* Mutex
|
|
|
|
* misc
|
|
|
|
* Mutex#owned? is no longer experimental.
|
|
|
|
|
2013-09-02 10:56:06 -04:00
|
|
|
* Numeric
|
|
|
|
* extended methods:
|
|
|
|
* Numeric#step allows the limit argument to be omitted, in which
|
|
|
|
case an infinite sequence of numbers is generated. Keyword
|
|
|
|
arguments `to` and `by` are introduced for ease of use.
|
|
|
|
|
2013-08-07 10:12:04 -04:00
|
|
|
* Process
|
2013-08-10 22:59:30 -04:00
|
|
|
* New methods:
|
|
|
|
* alternative methods to $0/$0=:
|
|
|
|
* Process.argv0() returns the original value of $0.
|
|
|
|
* Process.setproctitle() sets the process title without affecting $0.
|
|
|
|
* Process.clock_gettime
|
2013-08-31 11:12:39 -04:00
|
|
|
* Process.clock_getres
|
2013-08-07 10:12:04 -04:00
|
|
|
|
2013-04-19 13:50:38 -04:00
|
|
|
* String
|
|
|
|
* New methods:
|
2013-05-18 07:16:56 -04:00
|
|
|
* String#scrub and String#scrub! verify and fix invalid byte sequence.
|
2013-12-03 01:30:58 -05:00
|
|
|
If you want to use this function with older Ruby,
|
|
|
|
consider to use string-scrub.gem.
|
2013-04-19 13:50:38 -04:00
|
|
|
|
2013-09-19 01:33:47 -04:00
|
|
|
* Symbol
|
|
|
|
* All symbols are now frozen.
|
|
|
|
|
2013-04-02 07:28:57 -04:00
|
|
|
* pack/unpack (Array/String)
|
2013-04-02 10:58:32 -04:00
|
|
|
* Q! and q! directives for long long type if platform has the type.
|
2013-04-02 07:28:57 -04:00
|
|
|
|
2013-06-30 23:57:16 -04:00
|
|
|
* toplevel
|
|
|
|
* extended methods:
|
2013-07-31 05:29:40 -04:00
|
|
|
* main.using is no longer experimental. The method activates refinements
|
|
|
|
in the ancestors of the argument module to support refinement
|
|
|
|
inheritance by Module#include.
|
2013-06-30 23:57:16 -04:00
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== Core classes compatibility issues (excluding feature bug fixes)
|
2013-03-07 12:54:49 -05:00
|
|
|
|
2013-12-16 08:45:06 -05:00
|
|
|
* Hash
|
|
|
|
* incompatible changes:
|
2013-12-17 06:15:00 -05:00
|
|
|
* Hash#reject will return plain Hash object in the future versions, that
|
|
|
|
is the original object's subclass, instance variables, default value,
|
|
|
|
and taintedness will be no longer copied, so now warnings are emitted
|
|
|
|
when called with such Hash.
|
2013-12-16 08:45:06 -05:00
|
|
|
|
2013-05-08 04:47:26 -04:00
|
|
|
* IO
|
|
|
|
* incompatible changes:
|
|
|
|
* open ignore internal encoding if external encoding is ASCII-8BIT.
|
|
|
|
|
2013-08-08 01:56:01 -04:00
|
|
|
* Kernel#eval, Kernel#instance_eval, and Module#module_eval.
|
|
|
|
* Copies the scope information of the original environment, which means
|
|
|
|
that private, protected, public, and module_function without arguments
|
|
|
|
do not affect the environment outside the eval string.
|
|
|
|
For example, `class Foo; eval "private"; def foo; end; end' doesn't make
|
|
|
|
Foo#foo private.
|
|
|
|
|
2013-06-14 01:35:11 -04:00
|
|
|
* Kernel#untrusted?, untrust, and trust
|
|
|
|
* These methods are deprecated and their behavior is same as tainted?,
|
|
|
|
taint, and untaint, respectively. If $VERBOSE is true, they show warnings.
|
|
|
|
|
2013-03-07 12:54:49 -05:00
|
|
|
* Module#ancestors
|
2013-06-06 18:16:43 -04:00
|
|
|
* The ancestors of a singleton class now include singleton classes,
|
|
|
|
in particular itself.
|
2013-03-07 12:54:49 -05:00
|
|
|
|
2013-08-14 01:35:21 -04:00
|
|
|
* Module#define_method and Object#define_singleton_method
|
|
|
|
* Now they return the symbols of the defined methods, not the methods/procs
|
|
|
|
themselves.
|
|
|
|
|
2013-06-06 18:18:24 -04:00
|
|
|
* Numeric#quo
|
|
|
|
* Raises TypeError instead of ArgumentError if the receiver doesn't have
|
|
|
|
to_r method.
|
|
|
|
|
2013-08-08 21:49:38 -04:00
|
|
|
* Proc
|
|
|
|
* Returning from lambda proc now always exits from the Proc, not from the
|
2013-11-10 11:41:44 -05:00
|
|
|
method where the lambda is created. Returning from non-lambda proc exits
|
2013-08-08 21:49:38 -04:00
|
|
|
from the method, same as the former behavior.
|
|
|
|
|
2013-12-08 06:04:56 -05:00
|
|
|
String
|
|
|
|
* If invalid: :replace is specified for String#encode, replace
|
|
|
|
invalid byte sequence even if the destination encoding equals to
|
|
|
|
the source encoding.
|
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== Stdlib updates (outstanding ones only)
|
2013-03-11 13:27:03 -04:00
|
|
|
|
2013-09-12 22:39:03 -04:00
|
|
|
* CGI::Util
|
|
|
|
* All class methods modulized.
|
|
|
|
|
2013-05-22 06:38:37 -04:00
|
|
|
* Digest
|
|
|
|
* extended methods:
|
|
|
|
* Digest::Class.file takes optional arguments for its constructor
|
|
|
|
|
2013-04-12 23:08:28 -04:00
|
|
|
* Matrix
|
|
|
|
* Added Vector#cross_product.
|
|
|
|
|
2013-03-11 13:27:03 -04:00
|
|
|
* Net::SMTP
|
2013-04-03 07:43:42 -04:00
|
|
|
* Added Net::SMTP#rset to implement the RSET command
|
2013-03-23 16:36:42 -04:00
|
|
|
|
2013-11-22 01:38:51 -05:00
|
|
|
* objspace
|
|
|
|
* new method:
|
|
|
|
* ObjectSpace.trace_object_allocations
|
|
|
|
* ObjectSpace.trace_object_allocations_start
|
|
|
|
* ObjectSpace.trace_object_allocations_stop
|
|
|
|
* ObjectSpace.trace_object_allocations_clear
|
|
|
|
* ObjectSpace.allocation_sourcefile
|
|
|
|
* ObjectSpace.allocation_sourceline
|
|
|
|
* ObjectSpace.allocation_class_path
|
|
|
|
* ObjectSpace.allocation_method_id
|
|
|
|
* ObjectSpace.allocation_generation
|
|
|
|
* ObjectSpace.reachable_objects_from_root
|
2013-11-23 20:20:54 -05:00
|
|
|
* ObjectSpace.dump
|
|
|
|
* ObjectSpace.dump_all
|
2013-04-04 07:12:12 -04:00
|
|
|
|
2013-04-25 03:02:31 -04:00
|
|
|
* OpenSSL::BN
|
|
|
|
* extended methods:
|
|
|
|
* OpenSSL::BN.new allows Fixnum/Bignum argument.
|
|
|
|
|
2013-04-09 06:53:41 -04:00
|
|
|
* open-uri
|
|
|
|
* Support multiple fields with same field name (like Set-Cookie).
|
|
|
|
|
2013-11-22 01:38:51 -05:00
|
|
|
* Pathname
|
|
|
|
* New methods:
|
|
|
|
* Pathname#write
|
|
|
|
* Pathname#binwrite
|
|
|
|
|
2013-10-11 17:35:01 -04:00
|
|
|
* rake
|
|
|
|
* Updated to 10.1.0. Major changes include removal of the class namespace,
|
|
|
|
Rake::DSL to hold the rake DSL methods and removal of support for legacy
|
|
|
|
rake features.
|
|
|
|
|
|
|
|
For a complete list of changes since rake 0.9.6 see:
|
|
|
|
|
|
|
|
http://rake.rubyforge.org/doc/release_notes/rake-10_1_0_rdoc.html
|
|
|
|
|
|
|
|
http://rake.rubyforge.org/doc/release_notes/rake-10_0_3_rdoc.html
|
|
|
|
|
2013-12-08 06:04:56 -05:00
|
|
|
* RbConfig
|
|
|
|
* New constants:
|
|
|
|
* RbConfig::SIZEOF is added to provide the size of C types.
|
|
|
|
|
2013-09-18 20:11:45 -04:00
|
|
|
* RDoc
|
2013-12-16 15:14:50 -05:00
|
|
|
* Updated to 4.1.0. Major enhancements include a modified default template
|
|
|
|
* and accessibility enhancements.
|
2013-09-18 20:11:45 -04:00
|
|
|
|
|
|
|
For a list of minor enhancements and bug fixes see:
|
|
|
|
https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
|
|
|
|
|
2013-04-06 09:16:36 -04:00
|
|
|
* Resolv
|
|
|
|
* New methods:
|
|
|
|
* Resolv::DNS.fetch_resource
|
2013-04-06 10:32:34 -04:00
|
|
|
* One-shot multicast DNS support
|
2013-04-06 10:52:48 -04:00
|
|
|
* Support LOC resources
|
2013-04-06 09:16:36 -04:00
|
|
|
|
2013-09-12 22:39:03 -04:00
|
|
|
* REXML::Parsers::SAX2Parser
|
|
|
|
* Fixes wrong number of arguments of entitydecl event. Document of the event
|
2013-11-10 11:41:44 -05:00
|
|
|
says "an array of the entity declaration" but implementation passes two
|
2013-12-20 09:02:40 -05:00
|
|
|
or more arguments. It is an implementation bug but it breaks backward
|
2013-09-12 22:39:03 -04:00
|
|
|
compatibility.
|
|
|
|
|
|
|
|
* REXML::Parsers::StreamParser
|
|
|
|
* Supports "entity" event.
|
|
|
|
|
|
|
|
* REXML::Text
|
|
|
|
* REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
|
|
|
|
* REXML::Text#<< supports not "raw" mode.
|
|
|
|
|
2013-03-23 16:10:11 -04:00
|
|
|
* Rinda::RingServer, Rinda::RingFinger
|
2013-03-23 16:36:42 -04:00
|
|
|
* Rinda now supports multicast sockets. See Rinda::RingServer and
|
|
|
|
Rinda::RingFinger for details.
|
2013-03-11 13:27:03 -04:00
|
|
|
|
2013-06-04 17:54:58 -04:00
|
|
|
* RubyGems
|
2013-12-08 14:52:38 -05:00
|
|
|
* Updated to 2.2.0. Notable new features include:
|
|
|
|
|
|
|
|
* Gemfile or gem.deps.rb support including Gem.file.lock (experimental)
|
|
|
|
* Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
|
|
|
|
* Support for a sharing a GEM_HOME across ruby platforms and versions
|
|
|
|
|
|
|
|
For a complete list of enhancements and bug fixes see:
|
|
|
|
https://github.com/rubygems/rubygems/tree/master/History.txt
|
2013-06-04 17:54:58 -04:00
|
|
|
|
2013-09-12 22:39:03 -04:00
|
|
|
* Set
|
|
|
|
* New methods:
|
|
|
|
* Set#intersect?
|
|
|
|
* Set#disjoint?
|
|
|
|
|
2013-05-11 06:20:38 -04:00
|
|
|
* Socket
|
|
|
|
* New methods:
|
|
|
|
* Socket.getifaddrs
|
|
|
|
|
2013-05-21 09:51:25 -04:00
|
|
|
* StringScanner
|
|
|
|
* extended methods:
|
|
|
|
* StringScanner#[] supports named captures.
|
|
|
|
|
2013-07-26 07:15:06 -04:00
|
|
|
* Syslog::Logger
|
|
|
|
* Added facility.
|
|
|
|
|
2013-04-20 09:50:47 -04:00
|
|
|
* Tempfile
|
|
|
|
* New methods:
|
|
|
|
* Tempfile.create
|
|
|
|
|
2013-10-06 14:43:53 -04:00
|
|
|
* Timeout
|
2013-11-10 11:05:04 -05:00
|
|
|
* The exception to terminate the given block can no longer be rescued
|
2013-10-06 14:43:53 -04:00
|
|
|
inside the block, by default, unless the exception class is given
|
|
|
|
explicitly.
|
2013-05-30 03:59:21 -04:00
|
|
|
|
2013-10-16 23:32:15 -04:00
|
|
|
* TSort
|
|
|
|
* New methods:
|
2013-10-17 11:59:40 -04:00
|
|
|
* TSort.tsort
|
|
|
|
* TSort.tsort_each
|
|
|
|
* TSort.strongly_connected_components
|
|
|
|
* TSort.each_strongly_connected_component
|
2013-10-16 23:32:15 -04:00
|
|
|
* TSort.each_strongly_connected_component_from
|
|
|
|
|
2013-08-07 14:38:39 -04:00
|
|
|
* WEBrick
|
|
|
|
* The body of a response may now be a StringIO or other IO-like that responds
|
|
|
|
to #readpartial and #read.
|
|
|
|
|
2013-06-15 22:02:33 -04:00
|
|
|
* XMLRPC::Client
|
|
|
|
* New methods:
|
|
|
|
* XMLRPC::Client#http. It returns Net::HTTP for the client. Normally,
|
|
|
|
it is not needed. It is useful when you want to change minor HTTP client
|
|
|
|
options. You can change major HTTP client options by XMLRPC::Client
|
|
|
|
methods. You should use XMLRPC::Client methods for changing major
|
|
|
|
HTTP client options instead of XMLRPC::Client#http.
|
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== Stdlib compatibility issues (excluding feature bug fixes)
|
2013-04-25 01:27:41 -04:00
|
|
|
|
2013-07-18 22:22:11 -04:00
|
|
|
* Set
|
|
|
|
* incompatible changes:
|
|
|
|
* Set#to_set now returns self instead of generating a copy.
|
|
|
|
|
2013-04-25 01:27:41 -04:00
|
|
|
* URI
|
|
|
|
* incompatible changes:
|
|
|
|
* URI.decode_www_form follows current WHATWG URL Standard.
|
|
|
|
It gets encoding argument to specify the character encoding.
|
|
|
|
It now allows loose percent encoded strings, but denies ;-separator.
|
|
|
|
* URI.encode_www_form follows current WHATWG URL Standard.
|
|
|
|
It gets encoding argument to convert before percent encode.
|
|
|
|
UTF-16 strings aren't converted to UTF-8 before percent encode by default.
|
|
|
|
|
2013-12-08 23:39:49 -05:00
|
|
|
* curses
|
|
|
|
* Removed.
|
|
|
|
curses is now available as a gem.
|
|
|
|
See https://rubygems.org/gems/curses for details.
|
|
|
|
|
2013-06-13 20:53:37 -04:00
|
|
|
=== Built-in global variables compatibility issues
|
|
|
|
|
|
|
|
* $SAFE
|
|
|
|
* $SAFE=4 is obsolete. If $SAFE is set to 4 or larger, an ArgumentError
|
|
|
|
is raised.
|
|
|
|
|
2013-02-23 09:23:39 -05:00
|
|
|
=== C API updates
|
2013-11-22 23:46:34 -05:00
|
|
|
|
|
|
|
* rb_gc_set_params() is deprecated. This is only used in Ruby internal.
|
|
|
|
|
2013-11-22 23:51:05 -05:00
|
|
|
* rb_gc_count() added. This returns the number of times GC occurred.
|
2013-11-23 20:20:54 -05:00
|
|
|
|
2013-12-05 02:45:13 -05:00
|
|
|
* rb_gc_stat() added. This allows access to specific GC.stat() values from C
|
|
|
|
without any allocation overhead.
|
|
|
|
|
2013-12-05 05:30:38 -05:00
|
|
|
* rb_gc_latest_gc_info() added. This allows access to GC.latest_gc_info().
|
|
|
|
|
2013-11-23 20:20:54 -05:00
|
|
|
* rb_postponed_job_register() added. Takes a function callback which is invoked
|
|
|
|
when the VM is in a consistent state, i.e. to perform work from a C signal
|
|
|
|
handler.
|
|
|
|
|
|
|
|
* rb_profile_frames() added. Provides low-cost access to the current ruby stack
|
|
|
|
for callstack profiling.
|
|
|
|
|
|
|
|
* rb_tracepoint_new() supports new internal events accessible only from C:
|
|
|
|
* RUBY_INTERNAL_EVENT_NEWOBJ
|
|
|
|
* RUBY_INTERNAL_EVENT_FREEOBJ
|
|
|
|
* RUBY_INTERNAL_EVENT_GC_START
|
2013-12-05 02:45:13 -05:00
|
|
|
* RUBY_INTERNAL_EVENT_GC_END_MARK
|
|
|
|
* RUBY_INTERNAL_EVENT_GC_END_SWEEP
|
2013-11-26 03:41:44 -05:00
|
|
|
* Note that you *can not* specify "internal events" with normal events
|
|
|
|
(such as RUBY_EVENT_CALL, RUBY_EVENT_RETURN) simultaneously.
|