= NEWS 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 1.8.7 release === Lexical changes * empty symbol literal Empty symbol (:"") is allowed. * new hash immediates Ruby 1.9 style hash syntax e.g. { key: value } is now supported. Just like the normal hash syntax, you can put key-value pairs without enclosing parentheses at the end of a method argument list. e.g. some_method foo: 1, bar: 2 * new method invocation syntax Ruby 1.9 style special method invocation syntax f.(x), which is equivalent to f.call(x), is supported. This is mainly for use in invoking a Proc. * trailing comma in argument list A trailing comma can be put at the end of an argument list. e.g. MyStruct = Struct.new( :id, :name, :created_at, :description, ) === Configuration changes * version specific directories A new configure option --with-ruby-version is added, which allows user to specify the version string (defaulted to "1.8") for version specific directories such as library directories, ri directories and gem directories. === Library updates (outstanding ones only) * global functions * loop Return an enumerator if no block is given. * builtin classes * Array#try_convert * Hash#try_convert * IO#try_convert * Regexp#try_convert * String#try_convert New methods. * Array#sample New method which replaces #choice. * Array#sort_by! New method. * Enumerable#each_entry New method. * Enumerable#each_with_object * Enumerator#with_object New methods. * Enumerator.new { |y| ... } Now can generate an enumerator from a block that defines enumeration instead of an enumerable object. * Enumerator#rewind Now calls the "rewind" method of the enclosed object if defined. * Enumerator#inspect Implemented. * Hash#default_proc= New method. * Hash#key Renamed from Hash#index. * Kernel#singleton_class New method. * ENV.key Renamed from ENV.index. * IO#ungetbyte Added as an alias to #ungetc. * Proc#=== New method primarily for use in the case-when construct. * Process.daemon New method. * Range#cover? New alias to #include? for the forward compatibility with 1.9, in which the behavior of Range#include? has changed. * Regexp The regular expression /\s/ now properly matches a vertical tab character (VT: "\v") and /\S/ does not. It was a bug that /\s/ did not match VT when /[\s]/ does. It is clear that VT should always be regarded as white space, not to mention String#strip. * String#getbyte * String#setbyte * String#ord New methods for the forward compatibility with 1.9, in which the behavior of String#[] and String#[]= have changed. String#ord is $KCODE aware. * Symbol#succ * Symbol#next * Symbol#<=> * Symbol#casecmp * Symbol#=~ * Symbol#[] * Symbol#slice * Symbol#length * Symbol#size * Symbol#empty? * Symbol#match * Symbol#upcase * Symbol#downcase * Symbol#capitalize * Symbol#swapcase New methods. * base64 * Base64#strict_encode64 * Base64#strict_decode64 * Base64#urlsafe_encode64 * Base64#urlsafe_decode64 New methods. * dbm * gdbm * sdbm * {DBM,GDBM,SDBM}#key Renamed from #index. * digest * Digest::Class.base64digest * Digest::Instance#base64digest * Digest::Instance#base64digest! New methods. * fileutils * New option for FileUtils.rmdir(): :parents * logger * imported upstream version (logger/1.2.7) * do not raise an exception even if log writing failed. * do not raise ShiftingError if an aged file already exists. (no ShiftingError will be raised from 1.2.7, just warn() instead) * matrix * API change to adhere strictly to mathematical definitions: * Matrices must now be rectangular. * trace, regular?, singular? are defined only for square matrices * support for empty matrices * all integer matrices now have the right determinant (also an integer) * Matrix and Vector include Enumerable. * new methods: * Matrix.build * Matrix.empty * Matrix#each * Matrix#each_with_index * Matrix#empty? * open-uri * Added a lot of new options: * :ftp_active_mode => bool Specify false to enable FTP passive mode. It is adviced that this option should be explicitly set for forward compatibility because the default mode is changed in Ruby >= 1.9. * :read_timeout => seconds * :proxy_http_basic_authentication => [uri, user, password] * :redirect => bool * :ssl_verify_mode => OpenSSL::SSL::VERIFY_* * :ssl_ca_cert => filename * rational * Performace improved by making overall code optimization and introducing Fixnum#gcd implemented in C. * rexml * REXML::Document.entity_expansion_limit= New method to set the entity expansion limit. By default the limit is set to 10000. See the following URL for details. http://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/ * rss * 0.2.4 -> 0.2.7. * RSS::Maker.make * raise an exception instead of returning nil for invalid feed making. * requires block. * RSS::Maker.[] * new method to return maker class. * RSS::Maker.supported?(version) * new method to check if given version is supported. * RSS::Maker: item.guid.permanent_link? * new alias of item.guid.isPermaLink * RSS::Maker: item.guid.permanent_link= * new alias of item.guid.isPermaLink= * securerandom SecureRandom.uuid New method to generate a v4 random UUID. * set Set#classify Set#collect! Set#delete_if Set#divide Set#reject! SortedSet#delete_if Return an enumerator if no block is given. * stringio * StringIO#ungetbyte Added as an alias to #ungetc. === Compatibility issues (excluding feature bug fixes) * builtin classes * Enumerator#rewind See above. * open-uri * URI::InvalidURIError is converted to OpenURI::HTTPError if an invalid HTTP URI is given.