Misc #18404
closed3.1 documentation problems tracking ticket
Description
So far, comparing the NEWS.md to actual documentation at https://docs.ruby-lang.org/en/master/, I identified the following problems:
-
Random::Formatter: the explanations of how to use it are murky, examples do show just context-less examples like
prng.hex(10)
Merged:
-
Hash/keyword argument value omission—completely undocumented. PR: https://github.com/ruby/ruby/pull/5244Merged -
Queue::new should be rewritten (bad rendering for example, non-informative parameter name). PR: https://github.com/ruby/ruby/pull/5273Merged -
MergedThread::Backtrace.limit
isn't mentioned anywhere (Thread::Backtrace
doesn't even have its own page, only Thread::Backtrace::Location has). PR: https://github.com/ruby/ruby/pull/5305 -
Fiber::SchedulerInterfaceMerged
— no docs for new methods supported:address_resolve
,timeout_after
,io_read
,io_write
. PR: https://github.com/ruby/ruby/pull/5280 -
New Refinement class has no docs whatsoever. PR: https://github.com/ruby/ruby/pull/5272Merged -
Struct:Merged#keyword_init?
isn't mentioned anywhere. PR: https://github.com/ruby/ruby/pull/5279 -
GC:Merged::measure_total_time
,::measure_total_time=
,::total_time
isn't mentioned anywhere. UPD: was just a documentation rendering glitch, PR: https://github.com/ruby/ruby/pull/5306 -
String#unpack and #unpack1: newMergedoffset
param examples are given too early, before the main examples.unpack1
also has code formatting glitch. PR: https://github.com/ruby/ruby/pull/5331 -
Marshal#load: the new parameterMergedfreeze:
is not documented. PR: https://github.com/ruby/ruby/pull/5332 -
IO::Buffer no docs. PR: https://github.com/ruby/ruby/pull/5302Merged by hand by @ioquatix (Samuel Williams)
Small glitches in new docs:
-
Process._fork formatting ofMergedtt
. PR: https://github.com/ruby/ruby/pull/5270 -
Integer#try_convert: small typo: "Returns nil if object does not respond to :to_ary" (should beFixed already.:to_int
).
I'll try to address as much as I'll be able myself, but if some of the feature authors/other volunteers are willing to participate, I'll be glad :)
The ticket might be expanded if I'll notice something else.
Updated by ioquatix (Samuel Williams) over 3 years ago
IO::Buffer
is also totally undocumented.
Updated by zverok (Victor Shepelev) over 3 years ago
@ioquatix (Samuel Williams) oh, indeed. And new methods that can/should be supported by the scheduler aren't yet in the SchedulerInterface
:(
Updated by matheusrich (Matheus Richard) over 3 years ago
@zverok (Victor Shepelev) LMK if I can help you. I'm available @matheusrich on Twitter.
Updated by zverok (Victor Shepelev) over 3 years ago
@matheusrich if you are willing to participate, let's coordinate efforts here for better visibility :)
Are you willing to write some docs yourself? You'll need to fork ruby repo, make a local branch, fix docs, check them locally (you can run rdoc -o _rdoc_test
to render them into a separate folder; you also can run rdoc some_file.c -o rdoc_test
to render them quicker from only one file), and then make a PR to the original repo.
Which part you'd like to handle?
Updated by matheusrich (Matheus Richard) over 3 years ago
I wanna take the easiest one (documenting Struct#keyword_init
) to get my feet wet.
Updated by matheusrich (Matheus Richard) over 3 years ago
I can also tackle the small glitches/typos you last mentioned.
Updated by zverok (Victor Shepelev) over 3 years ago
@matheusrich That would be awesome! Thanks!
Updated by matheusrich (Matheus Richard) over 3 years ago
First PR is out: PR #5268 (merged) Improves Integer.try_convert
docs
Updated by matheusrich (Matheus Richard) over 3 years ago
@zverok (Victor Shepelev) there's a reference to keyword_init
on Struct here (if the link doesn't work, it's right above "Public Instance Methods"). Am I missing something?
Updated by zverok (Victor Shepelev) over 3 years ago
@matheusrich I'll look into the PRs in a few hours, thanks! About Struct
: we need documentation for this method:
MyStruct = Struct.new(:a, :b, keyword_init: true)
# => MyStruct(keyword_init: true)
MyStruct.keyword_init? # <=== this one
# => true
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by matheusrich (Matheus Richard) over 3 years ago
Gotcha! Thanks. I couldn't make it show up on the docs, though.
The docs are definitely there (struct.c:288)
/*
* call-seq:
* StructClass.keyword_init? -> true or false
*
* Returns true if the class was initialized with +keyword_init: true+.
* Otherwise returns false.
*
* Examples:
* Foo = Struct.new(:a)
* Foo.keyword_init? # => nil
* Bar = Struct.new(:a, keyword_init: true)
* Bar.keyword_init? # => true
* Baz = Struct.new(:a, keyword_init: false)
* Baz.keyword_init? # => false
*/
#define rb_struct_s_keyword_init_p rb_struct_s_keyword_init
I'm not super familiar with C, so I may be missing something. I wonder if the docs are not present because this method
is defined on the singleton class, not on the Struct class itself. If that's the case, maybe we can just add
a reference to it on the Keyword Argument section.
Updated by zverok (Victor Shepelev) over 3 years ago
OK, I'll try to fight it, there are quite a few weird tricks that might help
Updated by matheusrich (Matheus Richard) over 3 years ago
On another semi-unrelated note, isn't weird that this method returns nil
sometimes (e.g. Struct.new(:a).keyword_init? # => nil
)?
Is there any precedence for a question mark method returning nil
? I know nil
is falsey, but this might be confusing.
Edit: looks like File.size? does that.
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 3 years ago
Folks, maybe that's not obvious but I don't have commit rights.
So, unless somebody merges the PRs that are listed above—the docs for those features will be missing.
cc @nobu (Nobuyoshi Nakada) (I don't know who else I should tag, please advise)
Updated by zverok (Victor Shepelev) over 3 years ago
- Description updated (diff)
Updated by zverok (Victor Shepelev) over 2 years ago
- Status changed from Open to Closed