[DOC] Doc for StringIO#each#154
[DOC] Doc for StringIO#each#154kou merged 4 commits intoruby:masterfrom BurdetteLamar:strio_each_doc
Conversation
ext/stringio/stringio.c
Outdated
| * each(sep = $/, chomp: false) {|line| ... } -> self | ||
| * each(limit, chomp: false) {|line| ... } -> self | ||
| * each(sep, limit, chomp: false) {|line| ... } -> self |
There was a problem hiding this comment.
Could you keep using each_line?
each_line is preferred over each.
There was a problem hiding this comment.
I agree entirely
Can we switch the alias relationship between #each and #each_line? If so, I can do that here (along with changing the call-seq and examples); that would change this PR to not-[DOC].
Would that be okay?
There was a problem hiding this comment.
Do you intend the following change?
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index f81dd60..d424c59 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -2032,8 +2032,8 @@ Init_stringio(void)
rb_define_method(StringIO, "sync=", strio_set_sync, 1);
rb_define_method(StringIO, "tell", strio_tell, 0);
- rb_define_method(StringIO, "each", strio_each, -1);
rb_define_method(StringIO, "each_line", strio_each, -1);
+ rb_define_alias(StringIO, "each", "each_line");
rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
rb_define_method(StringIO, "each_char", strio_each_char, 0);
rb_define_method(StringIO, "each_codepoint", strio_each_codepoint, 0);We don't need it because IO doesn't do it: https://github.com/ruby/ruby/blob/fcf8b10b3c674eecf16c14fa6ee7f4211fa3b673/io.c#L15792-L15793
Can we add alias information by RDoc?
There was a problem hiding this comment.
RDoc adds alias info automatically.
There was a problem hiding this comment.
Could you keep using
each_line?each_lineis preferred overeach.
Done.
| * | ||
| * Leaves stream position as end-of-stream. | ||
| * | ||
| * **No Arguments** |
There was a problem hiding this comment.
How about using ### Subsection (####?) instead of **Subsection**?
There was a problem hiding this comment.
Doc guide says not to. I think a reason is that in some renderings, the heading can show up in the left-pane TOC.
ext/stringio/stringio.c
Outdated
| * Text = <<EOT | ||
| * First line | ||
| * Second line | ||
| * | ||
| * Fourth line | ||
| * Fifth line | ||
| * EOT | ||
| * | ||
| * Russian = 'тест' | ||
| * Data = "\u9990\u9991\u9992\u9993\u9994" |
There was a problem hiding this comment.
Could you use UPPER_CASE for constant names such as TEXT, RUSSIAN and DATA?
|
@kou, I also had forgotten keyword arg |
No description provided.