Skip to content
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

[DOC] Adjust some new features wording/examples. #9183

Merged
merged 8 commits into from Dec 14, 2023

Conversation

zverok
Copy link
Contributor

@zverok zverok commented Dec 9, 2023

(Part of working on this year's changelog.)

Some adjustments of the wording of the new features docs.

The changes are relatively small, so I packed them into one PR. If this is unacceptable, I can split in several (every change is its own commit), but I hope that it can be reviewed easily.

The changes in this PR:

  • Range#overlap?: changed wording of the last paragraph from less packed and extracted inline code as examples.
  • Thread::Queue#freeze: adjusted method docs with explanations why the queue can't be frozen.
  • TracePoint: added missing new :rescue event.
  • Module#set_temporary_name: slightly expanded examples and explanations with more visible consequences and possible usecases.
  • Process::Status#& and #>>: slightly expanded deprecation notice, removed >> usage from class header example (as it is deprecated, we shoudn't encourage it with the initial example).

Added Dec 12:

  • MatchData#named_captures: Fix rendering glitch due to wrong indentation.
  • Refinement#target: Adjust docs a bit, add deprecation notice to #refined_class
  • Dir#fchdir: Fix examples (they were confusing: the first one, after the description of the no-block form, demonstrated only a block form; the second one didn't demonstrate #fchdir at all)

@zverok zverok added the Documentation Improvements to documentation. label Dec 9, 2023
@zverok zverok self-assigned this Dec 9, 2023
thread_sync.c Outdated Show resolved Hide resolved
trace_point.rb Outdated Show resolved Hide resolved
variable.c Outdated Show resolved Hide resolved
variable.c Outdated
*
* c.new # => #<MyClass(with description):0x0....>
* c.instance_method(:foo) # => #<UnboundMethod: MyClass(with description)#foo() ...>
* c.new.method(:foo) #<Method: MyClass(with description)#foo() ...>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing # => in this line

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need an example regarding the method? It seems trivial. I don't think the code examples in the documentation should be more complicated than necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mame My point was to demonstrate that all related objects are affected (as an emphasis on "why would this be useful").
Though we probably can just leave one of the two lines (instance_method vs method), did you mean that?

@nobu
Copy link
Member

nobu commented Dec 10, 2023

FYI: Docs: tags do nothing for us. [DOC] is to suppress CIs.

range.c Outdated Show resolved Hide resolved
@zverok zverok changed the title Docs: Adjust some new features wording/examples. [DOC] Adjust some new features wording/examples. Dec 12, 2023
@zverok
Copy link
Contributor Author

zverok commented Dec 12, 2023

@jeremyevans I tried to address all of your concerns. I also added 3 more small commits (listed under Dec 12 in the PR description), I hope that's OK for "fixes a bit of everything in docs" PR 🤷

@zverok zverok requested a review from mame December 12, 2023 20:42
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost ready. Just a couple changes requested.

eval.c Outdated
*
* module M
* refine String do
* def indent(level)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best remove the method definition here, it doesn't affect the result and is unrelated to the method being documented.

variable.c Outdated
@@ -189,15 +189,25 @@ is_constant_path(VALUE name)
* m.set_temporary_name(nil) # => #<Module:0x0000000102c68f38>
* m.name #=> nil
*
* n = Module.new
* n.set_temporary_name("fake_name")
* c = Class.new do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with @mame here, the method already has significant examples, I don't think we need to add to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. My point here was to demonstrate one of the cases where redefining Module#name and/or Module#inspect wouldn't fix the related object's #inspect to be meaningful (and adds to a justification "why somebody needs a new method to set a pretend-name"). But probably, it doesn't look important enough anyway.

@zverok
Copy link
Contributor Author

zverok commented Dec 14, 2023

@jeremyevans I think I fixed all the comments. So I rebased it from master, and squashed all the fixups so it should be ready to merge.

Thanks for the reviews!

Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash when merging.

@zverok
Copy link
Contributor Author

zverok commented Dec 14, 2023

@jeremyevans Do you mean we need to have just one commit with all the changes (because I tried to structure it in a "commit-per-class" fashion)?

@jeremyevans
Copy link
Contributor

Yes.

@zverok zverok merged commit 570d7b2 into ruby:master Dec 14, 2023
25 of 26 checks passed
@zverok zverok deleted the adjust-new-features-docs branch December 14, 2023 21:01
@nurse nurse mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
4 participants