1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/doc/NEWS

653 lines
12 KiB
Text
Raw Normal View History

This file is not actively maintained. See ChangeLog for recent changes.
: -W option
new option to specify warning level. -W0 to shut up warnings, -W1 for normal level,
-W2 for verbose level. -w equals to -W1.
: Marshal to use marshal_dump and marshal_load
if a dumping object responds to 'marshal_dump', Marshal.dump calls
it, and dumps object returned. Marshal.load allocates a new instance
using "allocate", then calls its "marshal_load" with dumped data.
: lib/un
Imported. Used like 'ruby -run -e cp -- -p foo bar'. Nest, isn't it?
: lib/webrick
Imported. Generic Internet server kit.
: $stdin, $stdout, $stderr
can be assignable again. the original stdio are preserved as STDIN,
STDOUT, STDERR.
: multiple Tk interpreter
to allow safe Tk, etc.
: ext/openssl
Imported.
: ext/io/wait
Imported.
: ext/bigdecimal
Imported.
: Thread#group
new method to get belonging ThreadGroup.
: Kernel#warn(message)
a method to give warnings.
: Process::detach(pid)
new method to detach child process. child process will be "wait"ed
automagically.
: Object#instance_variable_set, Object#instance_variable_get
added.
: ext/Win32API/lib/win32/registry
added.
: lib/open-uri
Imported. This is an easy-to-use wrapper for net/http and net/ftp.
: lib/tmpdir
imported. add Dir::tmpdir() to determine the temporary directory.
: lib/cgi.rb
cgi[name] returns CGI::QueryExtension::Value that wraps string
value, no longer array.
: ext/syck
: lib/yaml
Imported.
: lib/rexml
Imported.
: lib/xmlrpc
: lib/gserver
Imported
: Class#inherited
Method is called when Class is inherited by another class.
class A; end
def A.inherited(by)
puts "A inherited by #{by.inspect}"
end
class B < A; end
Prints out "A inherited by B"
: String#split
if "sep" argument is a string, regular expression meta characters
are escaped internally.
: String#to_i
Now accepts optional base argument.
"101".to_i(10) => 101
"101".to_i(2) => 5
"101".to_i(8) => 65
"101".to_i(16) => 257
A base argument of 0 guesses at the base.
"101".to_i(0) => 101
"0b101".to_i(0) => 5
"0101".to_i(0) => 65
"0x101".to_i(0) => 1
: Set class (set.rb)
Imported.
: OptionParser module
Imported. Command line options utility library.
: parser
%W(...) notation, word list literal like %w(...) with the
exception that #{} interpolation is allowed.
: parser
Now arbitrary statements are allowed inside #{} interpolation
without escapes. In other hand, they can no longer access to
variables defined in eval.
: parser
Digits preceded minus sign is a literal integer.
: IO::sysopen
New method to get a raw file descriptor.
: TCPServer#accept, UNIXServer#accept, Socket#accept
New methods to return an accepted socket fd.
: Date and DateTime
lib/date.rb now provides both Date and DateTime.
Some methods have been renamed. But the old names are still alive.
Some new methods have been added (Date::parse, Date#strftime, etc.).
Date#mjd now returns the chronological modified Julian day number.
All facilities about tjd have been removed.
: Thread#join
Optional argument limits maximum time to wait the thread in second.
And returns nil if timed out.
: Array#filter
Previously deprecated, now removed. Use Array#collect!.
: dl module
Imported. An interface to the dynamic linker.
: IO#sysseek
Added.
: IO
64bit off_t support by Janathan Baker.
: abort()
Takes optional terminate message argument.
: iconv module
Imported. Wrapper library of (({iconv})).
: IO.fsync
New method that copies all in-memory parts of a file to disk and
waits until the deice reports that all parts are on stable storage.
Implemented with fsync(2) or equivalent.
: Dir#pos=
Returns the new position instead of self.
: Dir::glob
Now accepts optional FNM_* flags via the second argument, whereas
Dir::[] doesn't.
Dir.glob("makefile", File::FNM_CASEFOLD) #=> ['Makefile', 'makefile']
: fileutils module
Imported. File utility library.
: racc runtime module
Imported. Racc runtime library. (Racc is a parser generator for ruby)
: lib/tsort
Imported. Topological sorting library.
: ext/stringio
Imported. Pseudo (({IO})) class from/to (({String})).
: strscan module
Imported. Fast string scanner library.
: Array#pack, String#unpack
Allows comment in template strings.
: Array#pack, String#unpack
New templates 'q' and 'Q' for 64bit integer (signed and unsigned respectively).
: Array#new
Now takes block to fill initial values. E.g.
Array.new(10) { |i| i + 1 }
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
: Array#fill
Takes block to get the values to fill.
: Array#fetch
Takes block to get the default value.
: Hash#update
Takes block to resolve key conflict.
: IO#fsync
Added.
: Array expansion
Fixed with the following behavior:
a = *[1]
p a #=> [1]
Now 1-element array in rhs is expanded properly.
a = *[1]
p a #=> 1
: allocation framework
any instance of class can be allocated by class.allocate,
(except a few classes).
: break and next
Extended to take an optional expression, which is used as a value
for termination. [experimental]
: comparison of exception classes in a rescue clause
Changed to use Module#=== for comparing $! with the exception
class specified in each rescue clause.
As the previous behavior was to use kind_of?, the effect is limited
to the SystemCallError case. SystemCallError.=== has been newly
defined to return true when the two have the same errno. With this
change, SystemCallError's with the same errno, such as Errno::EAGAIN
and Errno::EWOULDBLOCK, can both be rescued by listing just one of
them.
: constants lookup
Improved at the performance of searching by using an internal hash
table.
: expression parenthesis in the first argument
Experimentally altered to get the following code (note the space
after p):
p ("xx"*2).to_i
Interpreted as:
p (("xx"*2).to_i)
Instead of:
(p("xx"*2)).to_i
: implicit comparison in conditional expressions
Obsoleted except when it is used in -e.
: between Range and $.
Use explicit comparison instead.
: between Regexp and $_
Use the unary method ~/re/ instead.
: to_str
Added to get objects which define to_str() treated as String's.
Now almost all the built-in methods try each argument with to_str()
when they expect it to be a String.
foo = Object.new
class <<foo
def to_str
"foo"
end
end
p File.open(foo)
=> -:7:in `open': wrong argument type Object (expected String) (TypeError)
ruby 1.6.4 (2001-04-19) [i586-linux]
=> -:7:in `open': No such file or directory - "foo" (Errno::ENOENT)
ruby 1.7.0 (2001-05-02) [i586-linux]
: pp module
Imported. Prity Printing library.
: open
Extended so that when the third argument is permission flags it
calls open(2) instead of fopen(3).
: Array#fetch(index [, default])
Added. If a default value isn't given, raises index error if index
is out of range.
: Array#insert(n, other, ...)
Added. [ruby-talk:14289]
This is much the same as (({ary[n,0] = [other,...]})) except
returing self.
ary = [0,1,2,3]
ary[2, 0] = [4, 5, 6]
p ary
ary = [0,1,2,3]
ary.insert(2, 4, 5, 6)
p ary
: Array#sort!
Changed to always return self without checking whether the sequence
of the elements was modified or not.
Beware that this behavior is not guaranteed to continue in the
future. Do not rely on its return value. [ruby-dev:12506]
: Curses
Updated. New methods and constants for using the mouse, character
attributes, colors and key codes have been added.
: Dir#path
Added.
: Dir.chdir
Extended to take a block.
: Dir.glob
Made to support meta-character escaping by a backslash. Wildcards
and spaces may now be escaped using a backslash.
: Dir.open
Changed to return what the block returns when a block is given, just
as File.open does. (It always returned (({nil})) in 1.6 and
prior)
: Dir.chdir
Changed to warn only when invoked from multiple threads or no block
is given. [ruby-dev:13823]
Dir.chdir('foo') {
Dir.chdir('bar') { # previously warned
puts Dir.pwd
}
}
: Enumerable#all?
: Enumerable#any?
: Enumerable#inject
: Enumerable#sort_by
Added.
: File#fnmatch, File::Constants::FNM_*
Added. Refer to the fnmatch(3) manpage for details.
Localism is FNM_DOTMATCH which has the opposite meaning of the
commonly known FNM_PERIOD, which does not exist in Ruby.
e.g.
# exclude files matching "*.bak" case-insensitively.
files.reject! {|fn| File.fnmatch?("*.bak", fn, File::FNM_CASEFOLD) }
: File.lchmod
: File.lchown
Added.
: File.open, IO.open
File mode can be specified by flags like open(2),
e.g. File::open(path, File::CREAT|File::WRONLY).
: IO.open
Made public. Can only associate an IO object with a file number
like IO.new and IO.for_fd, but can take a block.
: IO.for_fd
Added as a synonym for IO.new.
: IO.read
Added. Like IO.readlines, except it returns the entire file as a
string. [ruby-talk:9460]
: Interrupt
Made a subclass of SignalException. (It was a subclass of
Exception in 1.6 and prior)
: Marshal
Fixed not to dump anonymous classes/modules.
Fixed with loading modules.
: Math.acos(x)
: Math.asin(x)
: Math.atan(x)
: Math.cosh(x)
: Math.hypot(x,y)
: Math.sinh(x)
: Math.tanh(x)
Added.
: Method#==
Added.
: Module#include?
Added. [ruby-dev:13941]
: Module#included
Added. This is a hook called after Module#append_feature.
: Module#method_removed
: Module#method_undefined
Added.
: Module.new, Class.new
Extended to take block.
: Multiple assignment behavior
Fixed so that "*a = nil" results in "a == []".
: Net::HTTP
New version of Net::HTTP has introduced seriously incompatible
changes. For details, see document embedded in net/http.rb itself.
: NameError and NoMethodError
Moved and now NoMethodError < NameError < StandardError.
: NoMethodError
Added. [ruby-dev:12763]
: NotImplementError
Finally obsoleted. Use NotImplementedError.
: Object#singleton_method_removed
: Object#singleton_method_undefined
Added.
: Proc#==
Added.
: Process.times
Moved from Time.times. (Time.times still remains but emits a
warning)
: Process.waitall
Added.
: Process::Status
Added. (({$?})) is now an instance of this class.
: Range#step([step=1])
Added.
: Regexp#options
Added.
: Regexp.last_match(n)
Extended to take an optional argument.
: Signal
Added. This module has module functions Signal.trap and Signal.list.
: Socket.pack_sockaddr_in, Socket.unpack_sockaddr_in
Added. Utility for direct Socket access.
: Socket.pack_sockaddr_un, Socket.unpack_sockaddr_un
Added. Utility for direct Socket access.
: String#[regexp, nth]
Extended to accepts optional second argument.
It tries match between self and REGEXP, then returns the
content of the NTH regexp register.
: String#casecmp
Added. This is a case insensitive version of String#<=>.
: String#chomp
If $/ == "\n", chops off last newlines (any of \n, \r, \r\n).
: String#eql?
Changed to be always case sensitive.
: String#insert(n, other)
Added.
This is much the same as (({str[n, 0] = other})) except returing
self.
: String#lstrip, rstrip, lstrip!, rstrip!
Added. These strip only left or right part of a string.
: String#match
Added.
: String/Array methods
Returns an instance of receivers class.
: String.new
The first argument becomes optional.
: Symbol#intern
Added.
: Symbol.all_symbols
Added. [ruby-dev:12921]
: SystemCallError.===
Added. (See the "Comparison of exception classes in a rescue clause"
paragraph above) [ruby-dev:12670]
: SystemExit#status
Added.
: TCPServer#listen, UNIXServer#listen
Added.
: TCPSocket.new
: TCPSocket.open
Extended to take an address and a port number for the local side in
optional 3rd and 4th arguments.
: Time
Extended to accept a negative time_t. (Only when the platform
supports it)
p Time.at(-1)
=> Thu Jan 01 08:59:59 JST 1970
: Time#to_a
: Time#zone
Made to return "UTC" under gmtime. It used to return a platform
dependent value, typically "GMT", in 1.6 and prior.