diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-27 14:39:11 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-27 14:39:11 +0000 |
commit | 1c9d6dd646d508a3b4de0e84424283242708fe77 (patch) | |
tree | 1ca7f3b5bf15097d91e7451680a1634eab772092 /lib/logger.rb | |
parent | 2546a366ed0c20fb6ac644dfedd222ec471c0e46 (diff) |
* lib/logger.rb: leading 0 padding of timestamp usec part.
* lib/csv.rb (CSV.parse): [CAUTION] behavior changed. in the past,
CSV.parse accepts a filename to be read-opened (it was just a
shortcut of CSV.open(filename, 'r')). now CSV.parse accepts a
string or a stream to be parsed e.g.
CSV.parse("1,2\n3,r") #=> [['1', '2'], ['3', '4']]
* lib/csv.rb: CSV::Row and CSV::Cell are deprecated. these classes
are removed in the future. in the new csv.rb, row is represented
as just an Array. since CSV::Row was a subclass of Array, it won't
hurt almost all programs except one which depended CSV::Row#match.
and a cell is represented as just a String or nil(NULL). this
change will cause widespread destruction.
CSV.open("foo.csv", "r") do |row|
row.each do |cell|
if cell.is_null # using Cell#is_null
p "(NULL)"
else
p cell.data # using Cell#data
end
end
end
must be just;
CSV.open("foo.csv", "r") do |row|
row.each do |cell|
if cell.nil?
p "(NULL)"
else
p cell
end
end
end
* lib/csv.rb: [CAUTION] record separator(CR, LF, CR+LF) behavior
change. CSV.open, CSV.parse, and CSV,generate now do not force
opened file binmode. formerly it set binmode explicitly.
with CSV.open, binmode of opened file depends the given mode
parameter "r", "w", "rb", and "wb". CSV.parse and CSV.generate open
file with "r" and "w".
setting mode properly is user's responsibility now.
* lib/csv.rb: accepts String as a fs (field separator/column separator)
and rs (record separator/row separator)
* lib/csv.rb (CSV.read, CSV.readlines): added. works as IO.read and
IO.readlines in CSV format.
* lib/csv.rb: added CSV.foreach(path, rs = nil, &block). CSV.foreach
now does not handle "| cmd" as a path different from IO.foreach.
needed?
* test/csv/test_csv.rb: updated.
* test/ruby/test_float.rb: added test_strtod to test Float("0").
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/logger.rb')
-rw-r--r-- | lib/logger.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/logger.rb b/lib/logger.rb index 6c1e492f4e..363e9774b4 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -167,7 +167,7 @@ # I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074] INFO -- Main: info. # # You may change the date and time format in this manner: -# +# # logger.datetime_format = "%Y-%m-%d %H:%M:%S" # # e.g. "2004-01-03 00:54:26" # @@ -259,7 +259,7 @@ class Logger # # === Synopsis - # + # # Logger#add(severity, message = nil, progname = nil) { ... } # # === Args @@ -355,18 +355,18 @@ class Logger # # === Examples # - # logger.info("MainApp") { "Received connection from #{ip}" } + # logger.info("MainApp") { "Received connection from #{ip}" } # # ... # logger.info "Waiting for input from user" # # ... # logger.info { "User typed #{input}" } # # You'll probably stick to the second form above, unless you want to provide a - # program name (which you can do with <tt>Logger#progname=</tt> as well). + # program name (which you can do with <tt>Logger#progname=</tt> as well). # # === Return # - # See #add. + # See #add. # def info(progname = nil, &block) add(INFO, nil, progname, &block) @@ -427,7 +427,7 @@ private def format_datetime(datetime) if @datetime_format.nil? - datetime.strftime("%Y-%m-%dT%H:%M:%S.") << "%6d " % datetime.usec + datetime.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % datetime.usec else datetime.strftime(@datetime_format) end @@ -487,7 +487,7 @@ private # IO object). The beginning of each file created by this class is tagged # with a header message. # - # This class is unlikely to be used directly; it is a backend for Logger. + # This class is unlikely to be used directly; it is a backend for Logger. # def initialize(log = nil, opt = {}) @dev = @filename = @shift_age = @shift_size = nil @@ -517,7 +517,7 @@ private end end - @dev.write(message) + @dev.write(message) end # |