1# -*- rdoc -*-
2
3= NEWS for Ruby 1.8.7
4
5This document is a list of user visible feature changes made between
6releases except for bug fixes.
7
8Note that each entry is kept so brief that no reason behind or
9reference information is supplied with.  For a full list of changes
10with all sufficient information, see the ChangeLog file.
11
12== Changes since the 1.8.6 release
13
14=== Configuration changes
15
16* default C flags
17
18  Some C compiler flags may be added by default depending on your
19  environment.  Specify optflags=.. and warnflags=.. as necessary to
20  override them.
21
22* vendor_ruby directory
23
24  A new library directory named `vendor_ruby' is introduced in
25  addition to `site_ruby'.  The idea is to separate libraries
26  installed by the package system (`vendor') from manually (`site')
27  installed libraries preventing the former from getting overwritten
28  by the latter, while preserving the user option to override vendor
29  libraries with site libraries. (`site_ruby' takes precedence over
30  `vendor_ruby')
31
32  If you are a package maintainer, make each library package configure
33  the library passing the `--vendor' option to `extconf.rb' so that
34  the library files will get installed under `vendor_ruby'.
35
36  You can change the directory locations using configure options such
37  as `--with-sitedir=DIR' and `--with-vendordir=DIR'.
38
39=== Global constants
40
41* new constants
42
43  * RUBY_COPYRIGHT
44  * RUBY_DESCRIPTION
45
46=== Library updates (outstanding ones only)
47
48* new library
49
50  * securerandom
51
52* builtin classes
53
54  * Array#flatten
55  * Array#flatten!
56
57    Takes an optional argument that determines the level of recursion
58    to flatten.
59
60  * Array#eql?
61  * Array#hash
62  * Array#==
63  * Array#<=>
64
65    Handle recursive data properly.
66
67  * Array#index
68  * Array#rindex
69
70    Use a given block if no argument is given.
71
72  * Array#collect!
73  * Array#map!
74  * Array#each
75  * Array#each_index
76  * Array#reverse_each
77  * Array#reject
78  * Array#reject!
79  * Array#delete_if
80  * Array#select
81
82    Return an enumerator if no block is given.
83
84    Note that #map and #collect still return an array unlike Ruby 1.9
85    to keep compatibility.
86
87  * Array#pop
88  * Array#shift
89
90    Take an optional argument specifying the number of elements to
91    remove.
92
93  * Array#choice
94  * Array#combination
95  * Array#cycle
96  * Array#drop
97  * Array#drop_while
98  * Array#permutation
99  * Array#product
100  * Array#shuffle
101  * Array#shuffle!
102  * Array#take,
103  * Array#take_while
104
105    New methods.
106
107  * Binding#eval
108
109    New method.
110
111  * Dir#each
112  * Dir#foreach
113
114    Return an enumerator if no block is given.
115
116  * Enumerable::Enumerator
117
118    New class for various enumeration defined by the enumerator library.
119
120  * Enumerable#each_slice
121  * Enumerable#each_cons
122  * Object#to_enum
123  * Object#enum_for
124
125    New methods for various enumeration defined by the enumerator library.
126
127  * Enumerable#count
128  * Enumerable#cycle
129  * Enumerable#drop
130  * Enumerable#drop_while
131  * Enumerable#find_index
132  * Enumerable#first
133  * Enumerable#group_by
134  * Enumerable#max_by
135  * Enumerable#min_by
136  * Enumerable#minmax
137  * Enumerable#minmax_by
138  * Enumerable#none?
139  * Enumerable#one?
140  * Enumerable#take
141  * Enumerable#take_while
142
143    New methods.
144
145  * Enumerable#find
146  * Enumerable#find_all
147  * Enumerable#partition
148  * Enumerable#reject
149  * Enumerable#select
150  * Enumerable#sort_by
151
152    Return an enumerator if no block is given.
153
154    Note that #map and #collect still return an array unlike Ruby 1.9
155    to keep compatibility.
156
157  * Enumerable#inject
158
159    Accepts a binary operator instead of a block.
160
161  * Enumerable#reduce
162
163    New alias to #inject.
164
165  * Enumerable#to_a
166
167    Can take optional arguments and pass them to #each.
168
169  * Hash#eql?
170  * Hash#hash
171  * Hash#==
172
173    Handle recursive data properly.
174
175  * Hash#delete_if
176  * Hash#each
177  * Hash#each_key
178  * Hash#each_pair
179  * Hash#each_value
180  * Hash#reject!
181  * Hash#select
182  * ENV.delete_if
183  * ENV.each
184  * ENV.each_key
185  * ENV.each_pair
186  * ENV.each_value
187  * ENV.reject!
188  * ENV.select
189
190    Return an enumerator if no block is given.
191
192  * GC.stress
193  * GC.stress=
194
195    New methods.
196
197  * Integer#ord
198  * Integer#odd?
199  * Integer#even?
200  * Integer#pred
201
202    New methods.
203
204  * Integer#downto
205  * Integer#times
206  * Integer#upto
207
208    Return an enumerator if no block is given.
209
210  * IO#each
211  * IO#each_line
212  * IO#each_byte
213  * IO.foreach
214  * ARGF.each
215  * ARGF.each_line
216  * ARGF.each_byte
217
218    Return an enumerator if no block is given.
219
220  * IO#bytes
221  * IO#chars
222  * IO#each_char
223  * IO#getbyte
224  * IO#lines
225  * IO#readbyte
226  * ARGF.bytes
227  * ARGF.chars
228  * ARGF.each_char
229  * ARGF.getbyte
230  * ARGF.lines
231  * ARGF.readbyte
232
233    New methods.
234
235  * Method#name
236  * Method#owner
237  * Method#receiver
238  * UnboundMethod#name
239  * UnboundMethod#owner
240
241    New methods.
242
243  * Module#class_exec
244  * Module#module_exec
245
246    New methods.
247
248  * Numeric#step
249
250    Return an enumerator if no block is given.
251
252  * Object#instance_exec
253  * Object#tap
254
255    New methods.
256
257  * ObjectSpace.each_object
258
259    Return an enumerator if no block is given.
260
261  * Process.exec implemented.
262
263  * Range#each
264  * Range#step
265
266    Return an enumerator if no block is given.
267
268  * Regexp.union accepts an array of patterns.
269
270  * String#bytes
271
272    New method
273
274  * String#bytesize
275
276    New method, returning the size in bytes. (alias length and size)
277
278  * String#chars
279  * String#each_char
280  * String#lines
281  * String#partition
282  * String#rpartition
283  * String#start_with?
284  * String#end_with?
285
286    New methods.  These are $KCODE aware unlike #index, #rindex and
287    #include?.
288
289  * String#each_byte
290  * String#each
291  * String#each_line
292  * String#gsub(pattern)
293
294    Return an enumerator if no block is given.
295
296  * String#upto
297
298    An optional second argument is added to specify if the last value
299    should be included.
300
301  * StopIteration
302
303    New exception class that causes Kernel#loop to stop iteration when
304    raised.
305
306  * Struct#each
307  * Struct#each_pair
308
309    Return an enumerator if no block is given.
310
311  * Symbol#to_proc
312
313    New method.
314
315  * __method__
316
317    New global function that returns the name of the current method as
318    a Symbol.
319
320* enumerator
321
322  * Enumerator is now a built-in module.  The #next and #rewind
323    methods are implemented using the "generator" library.  Use with
324    care and be aware of the performance loss.
325
326* ipaddr
327
328  * New methods
329    * IPAddr#<=>
330    * IPAddr#succ
331
332      IPAddr objects are now comparable and enumerable having these
333      methods.  This also means that it is possible to have a Range
334      object between two IPAddr objects.
335
336    * IPAddr#to_range
337
338      A new method to create a Range object for the (network) address.
339
340  * Type coercion support
341    * IPAddr#&
342    * IPAddr#|
343    * IPAddr#==
344    * IPAddr#include?
345
346      These methods now accept a string or an integer instead of an
347      IPAddr object as the argument.
348
349* net/smtp
350
351  * Support SSL/TLS.
352
353* openssl
354
355  * New classes
356    * OpenSSL::PKey::EC
357    * OpenSSL::PKey::EC::Group
358    * OpenSSL::PKey::EC::Point
359    * OpenSSL::PKey::PKCS5
360    * OpenSSL::SSL::Session
361
362  * Documentation!
363
364  * Various new methods (see documentation).
365
366  * Remove redundant module namespace in Cipher, Digest, PKCS7, PKCS12.
367    Compatibility classes are provided which will be removed in Ruby 1.9.
368
369* shellwords
370
371  * Add methods for escaping shell-unsafe characters:
372    * Shellwords.join
373    * Shellwords.escape
374    * Array#shelljoin
375    * String#shellescape
376
377  * Add shorthand methods:
378    * Shellwords.split (alias shellwords)
379    * String#shellsplit
380
381* stringio
382
383  * StringIO#getbyte
384  * StringIO#readbyte
385
386    New methods. (aliases for compatibility with 1.9)
387
388  * StringIO#each_char
389  * StringIO#chars
390
391    New methods.
392
393  * StringIO#each
394  * StringIO#each_line
395  * StringIO#each_byte
396
397    Return an enumerator if no block is given.
398
399* tempfile
400
401  * Tempfile.open and Tempfile.new now accept a suffix for the
402    temporary file to be created.  To specify a suffix, pass an array
403    of [basename, suffix] as the first argument.
404
405      Tempfile.open(['image', 'jpg']) { |tempfile| ... }
406
407* tmpdir
408
409  * New method:
410
411    * Dir.mktmpdir
412
413* uri
414
415  * added LDAPS scheme.
416  * Change for RFC3986:
417    * FTP
418      * URI('ftp://example.com/foo').path #=> 'foo'
419      * URI('ftp://example.com/%2Ffoo').path #=> '/foo'
420      * URI::FTP.build([nil, 'example.com', nil, '/foo', 'i']).to_s #=> 'ftp://example.com/%2Ffoo;type=i'
421    * URI merge
422      * URI('http://a/b/c/d;p?q').merge('?y') == URI('http://a/b/c/d;p?y')
423      * URI('http://a/b/c/d;p?q').merge('/./g') == URI('http://a/g')
424      * URI('http://a/b/c/d;p?q').merge('/../g') == URI('http://a/g')
425      * URI('http://a/b/c/d;p?q').merge('../../../g') == URI('http://a/g')
426      * URI('http://a/b/c/d;p?q').merge('../../../../g') == URI('http://a/g')
427
428* rss
429
430  * 0.1.6 -> 0.2.4
431
432  * Fix image module URI
433
434  * Atom support
435
436  * ITunes module support
437
438  * Slash module support
439
440  * content:encoded with RSS 2.0 support
441
442=== Interpreter Implementation
443
444* passing a block to a Proc [experimental]
445
446  This implementation in current shape is known to be buggy/broken,
447  especially with nested block invocation.  Take this as an
448  experimental feature.
449
450* stack trace
451
452  On non-SystemStackError exception, full stack trace is shown.
453
454=== Compatibility issues (excluding feature bug fixes)
455
456* String#slice! had some unintentional bugs and they have been fixed
457  because either they disagreed with documentation or their respective
458  behavior of #slice.  Unfortunately, this causes some
459  incompatibilities in the following (somewhat rare) cases.
460
461  * #slice! no longer expands the array when an out-of-boundary value
462    is given.
463
464      # Ruby 1.8.6
465      a = [1,2]
466      a.slice!(4,0)   #=> nil
467      a               #=> [1,2,nil,nil]
468
469      # Ruby 1.8.7
470      a = [1,2]
471      a.slice!(4,0)   #=> nil
472      a               #=> [1,2]
473
474  * #slice! no longer raises an exception but returns nil when a
475    negative length or out-of-boundary negative position is given.
476
477      # Ruby 1.8.6
478      a = [1,2]
479      a.slice!(1,-1)  #=> (raises IndexError)
480      a.slice!(-5,1)  #=> (raises IndexError)
481
482      # Ruby 1.8.7
483      a = [1,2]
484      a.slice!(1,-1)  #=> nil
485      a.slice!(-5,1)  #=> nil
486
487* String#to_i, String#hex and String#oct no longer accept a sequence
488  of underscores (`__') as part of a number.
489
490    # Ruby 1.8.6
491    '1__0'.to_i     #=> 10
492    '1__0'.to_i(2)  #=> 2  # 0b10
493    '1__0'.oct      #=> 8  # 010
494    '1__0'.hex      #=> 16 # 0x10
495
496    # Ruby 1.8.7
497    '1__0'.to_i     #=> 1
498    '1__0'.to_i(2)  #=> 1
499    '1__0'.oct      #=> 1
500    '1__0'.hex      #=> 1
501
502  The old behavior was inconsistent with Ruby syntax and considered as
503  a bug.
504
505* date
506
507  * Date.parse
508
509    '##.##.##' (where each '#' is a digit) is now taken as 'YY.MM.DD'
510    instead of 'MM.DD.YY'.  While the change may confuse you, you can
511    always use Date.strptime() when you know what you are dealing
512    with.
513
514* REXML
515
516  * REXML::Document.entity_expansion_limit=
517
518    New method to set the entity expansion limit. By default the limit is
519    set to 10000.  See the following URL for details.
520
521    https://www.ruby-lang.org/en/news/2008/08/23/dos-vulnerability-in-rexml/
522
523* stringio
524
525  * StringIO#each_byte
526
527    The return value changed from nil to self.  This is what the
528    document says and the same as each_line() does.
529
530* tempfile
531
532  * The file name format has changed.  No dots are included by default
533    in temporary file names any more.  See above for how to specify a
534    suffix.
535
536* uri
537
538  * See above for details.
539
540== Changes since the 1.8.5 release
541
542=== New platforms/build tools support
543
544* IA64 HP-UX
545
546* Visual C++ 8 SP1
547
548* autoconf 2.6x
549
550=== Global constants
551
552* RUBY_PATCHLEVEL
553
554  New constant since 1.8.5-p1.
555
556=== Library updates (outstanding ones only)
557
558* builtin classes
559
560  * New method: Kernel#instance_variable_defined?
561
562  * New method: Module#class_variable_defined?
563
564  * New feature: Dir::glob() can now take an array of glob patterns.
565
566* date
567
568  * Updated based on date2 4.0.3.
569
570* digest
571
572  * New internal APIs for C and Ruby.
573
574  * Support for autoloading.
575
576      require 'digest'
577
578      # autoloads digest/md5
579      md = Digest::MD5.digest("string")
580
581  * New digest class methods: file
582
583  * New digest instance methods: clone, reset, new, inspect,
584    digest_length (alias size or length), block_length()
585
586  * New library: digest/bubblebabble
587
588  * New function: Digest(name)
589
590* fileutils
591
592  * New option for FileUtils.cp_r(): :remove_destination
593
594* nkf
595
596  * Updated based on nkf as of 2007-01-28.
597
598* thread
599
600  * Replaced with much faster mutex implementation in C.  The former
601    implementation, which is slow but considered to be stable, is
602    available with a configure option `--disable-fastthread'.
603
604* tk
605
606  * Updated Tile extension support based on Tile 0.7.8.
607
608  * Support --without-X11 configure option for non-X11 versions of
609    Tcl/Tk (e.g. Tcl/Tk Aqua).
610
611  * New sample script: irbtkw.rbw -- IRB on Ruby/Tk. It has no trouble
612    about STDIN blocking on Windows.
613
614* webrick
615
616  * New method: WEBrick::Cookie.parse_set_cookies()
617
618=== Compatibility issues (excluding feature bug fixes)
619
620* builtin classes
621
622  * String#intern now raises SecurityError when $SAFE level is greater
623    than zero.
624
625* date
626
627  * Time#to_date and Time#to_datetime are added as private methods.
628    They cause name conflict error in ActiveSupport 1.4.1 and prior,
629    which comes with Rails 1.2.2 and prior.  Updating ActiveSupport
630    and/or Rails to the latest versions fixes the problem.
631
632* digest
633
634  * The constructor does no longer take an initial string to feed.
635    The following examples show how to migrate:
636
637      # Before
638      md = Digest::MD5.new("string")
639      # After (works with any version)
640      md = Digest::MD5.new.update("string")
641
642      # Before
643      hd = Digest::MD5.new("string").hexdigest
644      # After (works with any version)
645      hd = Digest::MD5.hexdigest("string")
646
647  * Digest::Base#==
648
649    * self == string
650
651      Automatic detection between binary digest values and hexadecimal
652      digest values has been dropped.  It is always assumed that a
653      hexadecimal digest value is given for comparison.
654
655    * self == md
656
657      Digest objects are compared by the resulting digest values, not
658      by the exact vector states.
659
660* fileutils
661
662  * A minor implementation change breaks Rake <=0.7.1.
663    Updating Rake to 0.7.2 or higher fixes the problem.
664
665* tk
666
667  * Tk::X_Scrollable (Y_Scrollable) is renamed to Tk::XScrollable
668    (YScrollable). Tk::X_Scrollable (Y_Scrollable) is still available,
669    but it is an alias name.
670