Re: 2nd try at date/format.rb & pty.c

Eric Hodel <[email protected]>
Newsgroups gmane.comp.lang.ruby.documentation
Message-ID <[email protected]>
On Aug 18, 2006, at 3:02 PM, Mat Schaffer wrote:

> I have two patches.  The first is another try at the documentation  
> for date/format.rb.  Hopefully it's acceptable this time.  The  
> other is for pty.c.  I checked both of them with stdlib-doc and  
> they work fine.  But the link on the left frame for pty still links  
> to shl.rb.  I'm not sure how to make it point to the PTY class docs.
>
> Anyway, let me know what you think.

These patches appear to be against ruby_1_8.  Please send patches  
against HEAD.  If backporting to ruby_1_8 is non-trivial, please  
supply a separate patch for ruby_1_8.  I can handle trivial backporting.

Documentation must be wrapped to 80 characters.

Please send unified diffs.

pty_doc.diff:

 >  * PTY.getpty("command") do |output, input, pid|
 >  *   # At this point output and input are the command's output and  
input stream, respectively.  pid is the command's process ID.
 >  * end

This should be indented to turn it into a code block.

date_format_doc.diff

 > #   require 'date/format'
 > #   Date::zone_to_diff('est') => -18000
 > #   Date::zone_to_diff('jst') => 32400

Date::zone_to_diff should be Date.zone_to_diff

53,55c71,73
<   def self.__strptime(str, fmt, elem)
<     fmt.scan(/%[EO]?.|./mo) do |c|
<       cc = c.sub(/\A%[EO]?(.)\z/mo, '%\\1')
---
 >   def self.__strptime(str, fmt, elem) #:nodoc:
 >     fmt.scan(/%[EO]?.|./o) do |c|
 >       cc = c.sub(/\A%[EO]?(.)\Z/o, '%\\1')
151c169
< 	elem[if c[-1,1] == 'U' then :wnum0 else :wnum1 end] = val
---
 > 	elem[if c == '%U' then :wnum0 else :wnum1 end] = val
216,217d233
<       when /\A%(.)/m
< 	return unless str.sub!(Regexp.new('\\A' + Regexp.quote($1)), '')
495,496c513,514
<     fmt.scan(/%[EO]?.|./mo) do |c|
<       cc = c.sub(/\A%[EO]?(.)\z/mo, '%\\1')
---
 >     fmt.scan(/%[EO]?.|./o) do |c|
 >       cc = c.sub(/^%[EO]?(.)$/o, '%\\1')
536c554
< 	k = if c[-1,1] == 'U' then 0 else 1 end
---
 > 	k = if c == '%U' then 0 else 1 end
576,579c594
<       when /\A%(.)/m
< 	o << $1
<       else
< 	o << c
---
 >       else;      o << c

Those aren't just documentation changes.

-- 
Eric Hodel - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.