2nd try at date/format.rb & pty.c
Mat Schaffer <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
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. -Mat
date_format_doc.diff
(application/octet-stream, 2.8 KB)
Index: lib/date/format.rb
===================================================================
RCS file: /src/ruby/lib/date/format.rb,v
retrieving revision 1.8.2.7
diff -r1.8.2.7 format.rb
1a2,14
> #
> # This adds the functions Date#strftime, Date#asctime and Date::zone_to_diff.
> #
> # Date#strftime and Date#asctime appear to be identical to Time#strftime and Time#asctime.
> #
> # Date::zone_to_diff provides timezone offsets (in seconds from GMT) like the following:
> #
> # require 'date/format'
> # Date::zone_to_diff('est') => -18000
> # Date::zone_to_diff('jst') => 32400
> #
> # However, this type of mapping is generally inaccurate and the list of provided zones (Date::ZONES) isn't comprehensive.
> #
7a21
> # This is a mapping from English full month names to their numeric equivalents (reverse lookup for Date::MONTHNAMES).
13a28
> # This is a mapping from English full day of the week names to their numeric equivalents (reverse lookup for Date::DAYNAMES).
18a34
> # This is a mapping from abbreviated English month names to their numeric equivalents (reverse lookup for Date::ABBR_MONTHNAMES).
24a41
> # This is a mapping from abbreviated English day names to their numeric equivalents (reverse lookup for Date::ABBR_DAYNAMES).
29a47
> # This is a non-comprehensive list of various timezone abbreviations and their respective offset from GMT in seconds.
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)), '')
244c260
< def self._strptime(str, fmt='%F')
---
> def self._strptime(str, fmt='%F') #:nodoc:
249,250c265,266
< PARSE_MONTHPAT = ABBR_MONTHS.keys.join('|')
< PARSE_DAYPAT = ABBR_DAYS. keys.join('|')
---
> PARSE_MONTHPAT = ABBR_MONTHS.keys.join('|') #:nodoc:
> PARSE_DAYPAT = ABBR_DAYS. keys.join('|') #:nodoc:
252c268
< def self._parse(str, comp=false)
---
> def self._parse(str, comp=false) #:nodoc:
480a497
> #This provides offsets in seconds for the timezone abbreviations listed in Date::ZONES.
492a510
> #see Time#strftime
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
586a602
> #see Time#asctime
598a615
> #see Time#strftime
pty_doc.diff
(application/octet-stream, 1.3 KB)
Index: ext/pty/pty.c
===================================================================
RCS file: /src/ruby/ext/pty/pty.c,v
retrieving revision 1.19.2.4
diff -r1.19.2.4 pty.c
415c415,423
< /* ruby function: getpty */
---
> /*
> * PTY.getpty (not a public instance method)
> * This function is the entrance point for a PTY operation. Syntax is as follows, see pty/expect_sample.rb for an example.
> *
> * 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
> *
> */
478a487,496
> /*
> * The PTY module provides the ability to spawn external applications and interact with them as if they were running
> * on a console. This is particularly useful when dealing with an application that connects directly to the console (usually
> * for security purposes). Open3 will not catch direct console connections. PTY will.
> *
> * Note that communication with the external process is exactly like terminal interaction. For example, if the application
> * expects an EOF character, it must be explicity printed. Merely closing the input stream will not signal the external process.
> *
> * For a basic example of how to use PTY with expect, see pty/expect_example.rb .
> */