New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced RDoc for IO #5367
Enhanced RDoc for IO #5367
Conversation
io.c
Outdated
* f.gets(chomp: true)# => "" | ||
* f.gets(chomp: true) # => "Fourth line" | ||
* f.gets(chomp: true) # => "Fifth line" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* f.gets(chomp: true)# => "" | |
* f.gets(chomp: true) # => "Fourth line" | |
* f.gets(chomp: true) # => "Fifth line" | |
* f.gets(chomp: true) # => "" | |
* f.gets(chomp: true) # => "Fourth line" | |
* f.gets(chomp: true) # => "Fifth line" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
io.c
Outdated
@@ -3461,19 +3460,19 @@ io_write_nonblock(rb_execution_context_t *ec, VALUE io, VALUE str, VALUE ex) | |||
* When argument +out_string+ is given, | |||
* the returned value is +out_string+, whose content is replaced: | |||
* | |||
* f = File.new('t.txt') | |||
* f = File.ne w('t.txt') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* f = File.ne w('t.txt') | |
* f = File.new('t.txt') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
io.c
Outdated
* f.gets('l') # => "First l" | ||
* f.gets('li') # => "ine\nSecond li" | ||
* f.gets('lin') # => "ne\n\nFourth lin" | ||
* f.gets # => "e\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* f.gets('l') # => "First l" | |
* f.gets('li') # => "ine\nSecond li" | |
* f.gets('lin') # => "ne\n\nFourth lin" | |
* f.gets # => "e\n" | |
* f.gets('l') # => "First l" | |
* f.gets('li') # => "ine\nSecond li" | |
* f.gets('lin') # => "ne\n\nFourth lin" | |
* f.gets # => "e\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
io.c
Outdated
* f.gets('l') # => "First l" | ||
* f.gets('li') # => "ine\nSecond li" | ||
* f.gets('lin') # => "ne\n\nFourth lin" | ||
* f.gets # => "e\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* f.gets('l') # => "First l" | |
* f.gets('li') # => "ine\nSecond li" | |
* f.gets('lin') # => "ne\n\nFourth lin" | |
* f.gets # => "e\n" | |
* f.gets('l') # => "First l" | |
* f.gets('li') # => "ine\nSecond li" | |
* f.gets('lin') # => "ne\n\nFourth lin" | |
* f.gets # => "e\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
io.c
Outdated
* | ||
* There are two special line separators: | ||
* | ||
* - +nil+: The entire stream is read into a single string: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* - +nil+: The entire stream is read into a single string: | |
* - +nil+: The entire stream is read into a single string: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only one minor change requested.
* | ||
* These methods include: | ||
* | ||
* - IO::foreach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems odd to use periods after each of these entries. However, that's just an observation, so if you think periods should be used, I'm fine with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the periods.
io.c
Outdated
* | ||
* - Returns the next line as determined by line separator +sep+, | ||
* or +nil+ if none. | ||
* - But returns no more than <tt>limit+1</tt> bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to be correct for multibyte IO:
File.binwrite("t.t", "\u{10000}".b) # => 4
File.open('t.t', "r:UTF-8"){|f| f.gets("\n", 1).bytesize} #=> 4
The actual value is probably limit + maximum bytesize of single character in encoding - 1 (limit+3 for UTF-8, I'm not sure about other encodings). Not sure if there is a succinct way of stating that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of limit discussion recast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New wording looks good. Thanks!
Adds sections to class RDoc:
Revises example text file
t.txt
to:Revises examples that use the changed example file.
There are several other methods that will point to the added sections.