Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v2_1_0_preview2
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 313 lines (242 sloc) 9.855 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
# -*- rdoc -*-

= NEWS for Ruby 2.1.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.

== Changes since the 2.0.0 release

=== Language changes

* Now the default values of keyword arguments can be omitted. Those
  "required keyword arguments" need giving explicitly at the call time.

* Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
  * "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
    not accepted because it is misleading.
  * "42i" and "3.14i" are evaluated as Complex(0, 42) and Complex(0, 3.14),
    respectively.
  * "42ri" and "3.14ri" are evaluated as Complex(0, 42r) and Complex(0, 3.14r),
    respectively.

* def-expr now returns the symbol of its name instead of nil.

=== Core classes updates (outstanding ones only)

* Array
  * New methods
    * Array#to_h converts an array of key-value pairs into a Hash.

* Binding
  * New methods
    * Binding#local_variable_get(symbol)
    * Binding#local_variable_set(symbol, obj)
    * Binding#local_variable_defined?(symbol)

* Enumerable
  * New methods
    * Enumerable#to_h converts a list of key-value pairs into a Hash.

* Exception
  * New methods
    * Exception#cause provides the previous exception which has been caught
      at where raising the new exception.

* GC
  * added environment variable:
    * RUBY_HEAP_SLOTS_GROWTH_FACTOR: growth rate of the heap.

* 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

* IO
  * extended methods:
    * IO#seek supports SEEK_DATA and SEEK_HOLE as whence.
    * IO#seek accepts symbols (:CUR, :END, :SET, :DATA, :HOLE) for 2nd argument.
    * IO#read_nonblock accepts optional `exception: false` to return symbols
    * IO#write_nonblock accepts optional `exception: false` to return symbols

* Kernel
  * New methods:
    * Kernel#singleton_method

* Module
  * New methods:
    * Module#using, which activates refinements of the specified module only
      in the current class or module definition.
    * Module#singleton_class? returns true if the receiver is a singleton class
      or false if it is an ordinary class or module.
  * extended methods:
    * Module#refine is no longer experimental.
    * Module#include and Module#prepend are now public methods.

* Mutex
  * misc
    * Mutex#owned? is no longer experimental.

* 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.

* Process
  * 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
    * Process.clock_getres

* RbConfig
  * New constants:
    * RbConfig::SIZEOF is added to provide the size of C types.

* String
  * New methods:
    * String#scrub and String#scrub! verify and fix invalid byte sequence.
  * extended methods:
    * If invalid: :replace is specified for String#encode, replace
      invalid byte sequence even if the destination encoding equals to
      the source encoding.

* Symbol
  * All symbols are now frozen.

* pack/unpack (Array/String)
  * Q! and q! directives for long long type if platform has the type.

* toplevel
  * extended methods:
    * main.using is no longer experimental. The method activates refinements
      in the ancestors of the argument module to support refinement
      inheritance by Module#include.

=== Core classes compatibility issues (excluding feature bug fixes)

* IO
  * incompatible changes:
    * open ignore internal encoding if external encoding is ASCII-8BIT.

* 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.

* 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.

* Module#ancestors
  * The ancestors of a singleton class now include singleton classes,
    in particular itself.

* Module#define_method and Object#define_singleton_method
  * Now they return the symbols of the defined methods, not the methods/procs
    themselves.

* Numeric#quo
  * Raises TypeError instead of ArgumentError if the receiver doesn't have
    to_r method.

* Proc
  * Returning from lambda proc now always exits from the Proc, not from the
    method where the lambda is created. Returning from non-lambda proc exits
    from the method, same as the former behavior.

=== Stdlib updates (outstanding ones only)

* CGI::Util
  * All class methods modulized.

* Digest
  * extended methods:
    * Digest::Class.file takes optional arguments for its constructor

* Matrix
  * Added Vector#cross_product.

* Net::SMTP
  * Added Net::SMTP#rset to implement the RSET command

* 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

* OpenSSL::BN
  * extended methods:
    * OpenSSL::BN.new allows Fixnum/Bignum argument.

* open-uri
  * Support multiple fields with same field name (like Set-Cookie).

* Pathname
  * New methods:
    * Pathname#write
    * Pathname#binwrite

* 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

* RDoc
  * Updated to 4.1.0.preview.2. Major enhancements include a modified default
    template and accessibility enhancements.

    For a list of minor enhancements and bug fixes see:
    https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc

* Resolv
  * New methods:
    * Resolv::DNS.fetch_resource
  * One-shot multicast DNS support
  * Support LOC resources

* REXML::Parsers::SAX2Parser
  * Fixes wrong number of arguments of entitydecl event. Document of the event
    says "an array of the entity declaration" but implementation passes two
    or more arguments. It is an implementation bug but it breaks backword
    compatibility.

* REXML::Parsers::StreamParser
  * Supports "entity" event.

* REXML::Text
  * REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
  * REXML::Text#<< supports not "raw" mode.

* Rinda::RingServer, Rinda::RingFinger
  * Rinda now supports multicast sockets. See Rinda::RingServer and
    Rinda::RingFinger for details.

* RubyGems
  * Updated to 2.2.0.preview.2 For a list of enhancements and bug fixes see:
    https://github.com/rubygems/rubygems/blob/v2.2.0.preview.1/History.txt

* Set
  * New methods:
    * Set#intersect?
    * Set#disjoint?

* Socket
  * New methods:
    * Socket.getifaddrs

* StringScanner
  * extended methods:
    * StringScanner#[] supports named captures.

* Syslog::Logger
  * Added facility.

* Tempfile
  * New methods:
    * Tempfile.create

* Timeout
  * The exception to terminate the given block can no longer be rescued
    inside the block, by default, unless the exception class is given
    explicitly.

* TSort
  * New methods:
    * TSort.tsort
    * TSort.tsort_each
    * TSort.strongly_connected_components
    * TSort.each_strongly_connected_component
    * TSort.each_strongly_connected_component_from

* WEBrick
  * The body of a response may now be a StringIO or other IO-like that responds
    to #readpartial and #read.

* 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.

=== Stdlib compatibility issues (excluding feature bug fixes)

* Set
  * incompatible changes:
    * Set#to_set now returns self instead of generating a copy.

* 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.

=== Built-in global variables compatibility issues

* $SAFE
  * $SAFE=4 is obsolete. If $SAFE is set to 4 or larger, an ArgumentError
    is raised.

=== C API updates
Something went wrong with that request. Please try again.