Skip to content

Instantly share code, notes, and snippets.

@jimcavoli
Created September 14, 2016 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimcavoli/3541a069d06d755e5c6d19d5cf28bb1b to your computer and use it in GitHub Desktop.
Save jimcavoli/3541a069d06d755e5c6d19d5cf28bb1b to your computer and use it in GitHub Desktop.
A simplified changelog extracted from ruby/ruby for version 2.0.0 to 2.2.5 upgrades

Ruby 2.0.0 to Ruby 2.2.5 NEWS-noted changes

These changes were reported in the high-level summary NEWS changelog provided by the Ruby project. They are a synthesis of changes from the NEWS logs of the changes from 2.0.0 to 2.1.0 and from 2.1.0 to 2.2.5 (there were no NEWS notes from 2.2.4 to 2.2.5 that changed). Any C API updates have been omitted, and changes have been compressed to include updates and compatibility changes for each class together. Ordering may also vary from the official NEWS changelog.

Language

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

  • nil/true/false

    • nil/true/false objects are frozen. [Feature #8923]
  • Hash literal

    • Symbol key followed by a colon can be quoted. [Feature #4276]
  • default argument fixed a very longstanding bug that an optional argument was not accessible in its default value expression. [Bug #9593]

Built-in global variables

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

Core class updates

  • 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)
      • Binding#local_variables
      • Binding#receiver
  • Dir

    • New methods:
      • Dir#fileno
    • incompatible changes:
      • Dir#glob returns composed characters (previously Apple Modofied UTF-8).
  • Enumerable

    • New methods:
      • Enumerable#to_h converts a list of key-value pairs into a Hash.
      • Enumerable#slice_after
      • Enumerable#slice_when
    • Extended methods:
      • min, min_by, max and max_by supports optional argument to return multiple elements.
    • Enumerable#slice_before's state management deprecated.
    • Enumerable#chunk's state management deprecated.
  • Exception

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

    • New methods:
      • Float#next_float
      • Float#prev_float
  • File

    • New methods:
      • File.birthtime
      • File#birthtime
  • File::Stat

    • New methods:
      • File::Stat#birthtime
  • GC

    • Improvements:
      • introduced the generational GC a.k.a RGenGC.
      • Introduce incremental marking for major GC. [Feature #10137]
    • 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)
    • incompatible changes:
    • GC.latest_gc_info returns :state to represent current GC status.
  • Hash

    • incompatible changes:
      • 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.
      • Change overriding policy for duplicated key. [Bug #10315] { **hash1, **hash2 } contains values of hash2 for duplicated keys.
  • 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

    • Improvements
      • IO#nonblock_read and IO#nonblock_write for pipes on Windows are supported.
    • 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
    • incompatible changes:
      • open ignore internal encoding if external encoding is ASCII-8BIT.
      • When flushing file IO with IO#flush, you cannot assume that the metadata of the file is updated immediately. On some platforms (especially Windows), it is delayed until the filesystem load is decreased. Use IO#fsync if you want to guarantee updating metadata.
    • IO#each_codepoint raises an exception at incomplete character before EOF when conversion takes place. [Bug #11444]
  • Kernel

    • New methods:
      • Kernel#singleton_method
      • Kernel#itself
    • Improvements
      • Kernel#throw raises UncaughtThrowError, subclass of ArgumentError when there is no corresponding catch block, instead of ArgumentError.
    • 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.
  • Math

    • incompatible changes:
      • Math.log now raises Math::DomainError instead of returning NaN if the base is less than 0, and returns NaN instead of -infinity if both of two arguments are 0.
      • Math.atan2 now returns values like as expected by C99 if both two arguments are infinity.
  • 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.
    • 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.
  • 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.
    • 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.
    • incompatible changes:
      • ArgumentError is no longer raised when lambda Proc is passed as a block, and the number of yielded arguments does not match the formal arguments of the lambda, if just an array is yielded and its length matches.
  • 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
    • Extended method:
      • Process execution methods such as Process.spawn opens the file in write mode for redirect from [:out, :err].
    • Process execution methods such as Process.spawn opens the file in write mode for redirect from [:out, :err]. Before Ruby 2.2, it was opened in read mode.
  • String

    • New methods:
      • String#scrub and String#scrub! verify and fix invalid byte sequence. If you want to use this function with older Ruby, consider to use string-scrub.gem.
      • String#unicode_normalize
      • String#unicode_normalize!
      • String#unicode_normalized?
    • literal.freeze is now optimized to return the same object
    • 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.
    • Improvements
      • Most symbols which are returned by String#to_sym and String#intern are GC-able.
  • Method

    • New methods:
      • Method#curry([arity]) returns a curried Proc.
      • Method#super_method returns a Method of superclass, which would be called when super is used.
  • 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.

Stdlib changes

  • CGI::Util

    • All class methods modulized.
  • Continuation

    • callcc is obsolete. use Fiber instead.
  • curses

  • Digest

    • extended methods:
      • Digest::Class.file takes optional arguments for its constructor
    • Digest() should now be thread-safe. If you have a problem with regard to on-demand loading under a multi-threaded environment, preload "digest/" modules on boot or use this method instead of directly referencing Digest::.
    • Digest::HMAC has finally ceased to exist. Use OpenSSL::HMAC or an external gem instead.
    • Digest::HMAC has been removed just as previously noticed.
  • DL

    • DL has been removed from stdlib. Please use Fiddle instead!
  • Etc

    • New methods:
      • Etc.uname
      • Etc.sysconf
      • Etc.confstr
      • IO#pathconf
      • Etc.nprocessors
  • Find, Pathname

    • Extended methods:
      • find method accepts "ignore_error" keyword argument.
  • GServer

    • GServer is extracted to gserver gem. It's unmaintain code.
  • Logger

    • Logger::Application is extracted to logger-application gem. It's unmaintain code.
  • ObjectSpace (after requiring "objspace")

    • ObjectSpace.memsize_of(obj) returns a size includes sizeof(RVALUE). [Bug #8984]
  • Matrix

    • Added Vector#cross_product.
    • New methods:
      • Matrix#first_minor(row, column) returns the submatrix obtained by deleting the specified row and column.
      • Matrix#cofactor(row, column) returns the (row, column) cofactor which is obtained by multiplying the first minor by (-1)**(row + column).
      • Matrix#adjugate returns the adjugate of the matrix.
      • hstack and vstack are new instance and class methods to stack matrices horizontally and vertically.
      • Matrix#laplace_expansion(row_or_column: num) returns the laplace_expansion along the +num+ -th row or column.
      • Vector.basis(size:, index:) returns the specified basis vector.
      • Unary - and + added for Vector and Matrix.
      • Vector#cross_product generalized to arbitrary dimensions.
      • Vector#dot and #cross are aliases for #inner_product and #cross_product.
      • Vector#angle_with returns the angle with its argument
      • New instance and class method independent? to test linear independence.
  • 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
      • ObjectSpace.dump
      • ObjectSpace.dump_all
  • OpenSSL::BN

    • extended methods:
      • OpenSSL::BN.new allows Fixnum/Bignum argument.
  • open-uri

    • Support multiple fields with same field name (like Set-Cookie).
  • Pathname

    • Pathname#/ is aliased to Pathname#+.
    • New methods:
      • Pathname#write
      • Pathname#binwrite
      • Pathname#birthtime
  • Prime

    • incompatible changes:
      • Prime.prime? now returns false for negative numbers. This method should not be used to know the number is composite or not. [Bug #7395]
  • Psych

    • Removed Psych::EngineManager [Bug #8344]
  • rake

  • RbConfig

    • New constants:
      • RbConfig::SIZEOF is added to provide the size of C types.
  • 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 backward 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

  • Set

    • New methods:
      • Set#intersect?
      • Set#disjoint?
    • incompatible changes:
      • Set#to_set now returns self instead of generating a copy.
  • Socket

    • New methods:
      • Socket.getifaddrs
  • StringScanner

    • extended methods:
      • StringScanner#[] supports named captures.
  • Syslog::Logger

    • Added facility.
  • Tempfile

    • New methods:
      • Tempfile.create
  • Time

    • Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce fixed-offset Time objects. It is happen when usual localtime doesn't preserve the offset from UTC.
    • Time.httpdate produces always UTC Time object.
    • Time.strptime raises ArgumentError when no date information.
  • 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
    • TSort.tsort_each, TSort.each_strongly_connected_component and TSort.each_strongly_connected_component_from returns an enumerator if no block given.
  • 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.
      • support RFC 3986. [Feature #2542]
  • 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.
    • Added new parser class named LibXMLStreamParser.
  • ext/date/lib/date/format.rb

    • Removed because it's empty file.
  • lib/rational.rb

    • Removed because it is deprecated from 2009.
  • lib/complex.rb

    • Removed because it is deprecated from 2009.
  • lib/prettyprint.rb

    • Removed PrettyPrint#first?
  • lib/mathn.rb

    • Show deprecated warning [Feature #10169]
  • lib/minitest/*.rb

    • Removed because it conflicts to minitest 5. [Feature #9711]
  • lib/test/**/*.rb

    • Removed because it conflicts to minitest 5, and it was just an wrapper of minitest 4. [Feature #9711]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment