Commit graph

808 commits

Author SHA1 Message Date
Stan Lo
93f8de777f [ruby/rdoc] Expand rdoc-ref targets at the end of ri output
(https://github.com/ruby/rdoc/pull/1141)

There have been several document refactors in ruby/ruby that extract
individual methods/classes' documentation into separate files, like
ruby/ruby#6567

Because RI is not capable of rendering those references, RI users
are left with dramatically fewer documentation on those methods/classes.

This commit adds a new option `--expand-ref` (default: true) to expand
all the rdoc-ref targets at the end of the output.

9e2b28c6e3
2024-12-09 17:21:01 +00:00
OKURA Masafumi
895f2c2152 [ruby/rdoc] lint: Remove unreachable code
(https://github.com/ruby/rdoc/pull/1137)

This is an attempt to utilize RuboCop further.
RuboCop was added in 9262fdd43a
but only a few rules have been enabled.
I believe we can utilize RuboCop more for better code quality,
especially with Lint cops.
This is the first step to enable other Lint cops.
This commit also exclude some auto generated files.

a53287fce0
2024-12-08 23:14:18 +00:00
nicholas a. evans
dd43af3be7 [ruby/rdoc] Use distinct styles for note lists and label lists
(https://github.com/ruby/rdoc/pull/1209)

* Use the original `label` description list style

As a default for all description lists, the original "label" style is
more readable.

This is slightly different from the original `label` dl though:
* slightly increased left margin for `dd` (to 1em)
* removed right margin on `dd`
* removed `dt` bottom margin and `dd` top margin, to reduce the gap
  between the term and its description (to only the standard line-height
  gap).

* Add closing tags for description list terms

Without the closing tags, the dt elements contain whitespace after the
text.  This normally isn't a big deal, but does mess some things up,
e.g: using `::after` with `content: ", "` in stylesheets.

* Restore float:left style for note lists

Unlike the original note list styles, this version sets the line-height
for all `dt` elements to be the same as the `p` elements contained
inside the `dd`, so that the second line has the same indentation as all
subsequent lines.

* Add commas between note list terms

9e69ea6d75
2024-12-08 10:43:47 +00:00
Stan Lo
2ecd2fe0ed [ruby/rdoc] Deprecate main and title directives
(https://github.com/ruby/rdoc/pull/1218)

* Deprecate :main: directive

* Deprecate :title: direcive

* Update documentation

* Remove :main: directive's usage

* Update test cases

* Add '.rdoc_options' to suggested alternatives

e2d4ac9dad
2024-12-05 11:36:34 +00:00
Hiroshi SHIBATA
d85e8b5339 Reapply "[ruby/rdoc] fix: C variables should never show up in Ancestors tree"
This reverts commit 0fe82ae087.
2024-12-03 10:59:32 +09:00
Mike Dalessio
af5c34fb0b [ruby/rdoc] Prefer String#ord to #codepoints[0]
(https://github.com/ruby/rdoc/pull/1220)

09d7f35420

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-12-02 22:08:03 +00:00
Mike Dalessio
4cce246d86 [ruby/rdoc] ClassModule#superclass= accepts a ClassModule as an
argument
(https://github.com/ruby/rdoc/pull/1222)

It is necessary for ClassModule's instance variable @superclass to
always be a String (or nil) so that the class can be saved with
`#marshal_dump` and loaded with `#marshal_load`.

However, there's no type checking being done, which allows a bug like
the one reported in #1221 (which was introduced in #1217) that sets
superclass to a ClassModule. That bug requires:

- setting a superclass to a NormalClass
- marshal_save
- marshal_load (which raises an exception)

With this change, passing a ClassModule to ClassModule#superclass= is
explicitly allowed by saving the full name of the ClassModule in the
@superclass instance variable.

9ced6d534c
2024-12-02 22:07:31 +00:00
Hiroshi SHIBATA
0fe82ae087
Revert "[ruby/rdoc] fix: C variables should never show up in Ancestors tree"
This reverts commit 2923f42ed7.

3375565361 (step):23:1031

```
/home/runner/work/actions/actions/snapshot-master/lib/rdoc/code_object.rb:322:in 'RDoc::CodeObject#parent': undefined method 'find_class_or_module' for nil (NoMethodError)
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/code_object/class_module.rb:342:in 'RDoc::ClassModule#marshal_dump'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:878:in 'Marshal.dump'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:878:in 'block in RDoc::Store#save_class'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:877:in 'IO.open'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:877:in 'RDoc::Store#save_class'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:763:in 'block in RDoc::Store#save'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:762:in 'Array#each'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/store.rb:762:in 'RDoc::Store#save'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/generator/ri.rb:27:in 'RDoc::Generator::RI#generate'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:528:in 'block in RDoc::RDoc#generate'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:522:in 'Dir.chdir'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:522:in 'RDoc::RDoc#generate'
	from /home/runner/work/actions/actions/snapshot-master/lib/rdoc/rdoc.rb:501:in 'RDoc::RDoc#document'
	from ./tool/rdoc-srcdir:27:in '<main>'
```
2024-12-02 09:39:56 +09:00
Mike Dalessio
83bd9191d8 [ruby/rdoc] Methods are sorted symbols-first
(https://github.com/ruby/rdoc/pull/1219)

There are three distinct ranges of symbols in ASCII:

- the range below "A", 0..64 in decimal
- the range between "Z" and "a", 91..96 in decimal
- the range above "z", 123..127 in decimal

With this change, any method starting with a character in these
"symbol ranges" will be sorted before a method starting with an alpha
ASCII character. The remaining methods, all starting with alpha or
8-bit characters, will be sorted against each other exactly as before.

Specifically this addresses the issue from #1204 which is that `#[]`
and `#^` were previously sorted _after_ the alpha methods. These
methods will now be sorted before alpha methods.

Fixes https://github.com/ruby/rdoc/pull/1204

a4f13d242b
2024-11-30 16:06:54 +00:00
Mike Dalessio
2923f42ed7 [ruby/rdoc] fix: C variables should never show up in Ancestors tree
(https://github.com/ruby/rdoc/pull/1217)

If a NormalClass's superclass is a C enclosure, then update the
superclass to point to the RDoc::NormalClass.

This is done in a single pass after all files have been parsed.

Fixes https://github.com/ruby/rdoc/pull/1205.

1ecd9581b1
2024-11-30 12:31:42 +00:00
Stan Lo
36ed9c2fc9 [ruby/rdoc] Improve how gemspec's files are defined
(https://github.com/ruby/rdoc/pull/1212)

Currently, the gemspec's files are defined by hand, which is error-prone.

For example: https://github.com/ruby/rdoc/pull/1211

This commit uses `Dir.glob` where possible to reduce the risk of that
happening again.

- Additional files added with this approach:

    ```
    # This should have been added by only captured by this commit
    lib/rdoc/parser/prism_ruby.rb

    # These are folders and can be included/ignored either way
    lib/rdoc/generator/template/darkfish
    lib/rdoc/generator/template/darkfish/css
    lib/rdoc/generator/template/darkfish/fonts
    lib/rdoc/generator/template/darkfish/images
    lib/rdoc/generator/template/darkfish/js
    lib/rdoc/generator/template/json_index
    lib/rdoc/generator/template/json_index/js
    ```

- Files that are ignored after this change:

    ```
    # They make no difference on documentation generation
    # Probably can be removed
    lib/rdoc/generator/template/darkfish/.document
    lib/rdoc/generator/template/json_index/.document
    ```

ac2a151f10
2024-11-28 12:18:11 +00:00
Stan Lo
6dc3332650 [ruby/rdoc] Bump version to v6.8.1
9a7ab17f40
2024-11-19 11:51:56 +00:00
Ihor Shevkun
39f421c9f1 [ruby/rdoc] Update rdoc.gemspec
(https://github.com/ruby/rdoc/pull/1211)

10596827f0
2024-11-19 11:32:26 +00:00
Hiroshi SHIBATA
da8c8743d5 [ruby/rdoc] Bump up v6.8.0
cf09b2ebb8
2024-11-19 05:47:37 +00:00
Stan Lo
ee0915feeb [ruby/rdoc] Extract excerpt from raw pages correctly
(https://github.com/ruby/rdoc/pull/1200)

Fixes https://bugs.ruby-lang.org/issues/20862

3c678249e2
2024-11-18 10:32:31 +00:00
Alexis Bernard
202a377d21 [ruby/rdoc] Split list of class and instance methods in two
(https://github.com/ruby/rdoc/pull/1206)

Looking for a method is easier because eyes don't have to skip dashes or
double colon.

6852567640
2024-11-13 16:13:21 +00:00
Alexis Bernard
7ae4b858b3 [ruby/rdoc] Display class ancestors in the sidebar #1183
50dda13426
2024-11-04 17:34:27 +00:00
Stan Lo
53df2a3c54 [ruby/rdoc] Use thicker fonts with high contrast to improve
readability
(https://github.com/ruby/rdoc/pull/1197)

7fb0e509ec
2024-10-31 10:05:19 +00:00
Nobuyoshi Nakada
10e0ebc7c2 [ruby/rdoc] Remove details markers in HTML documents
`summary {list-style: none;}` still does not work in Safari 18.

c6a0a6a0d5
2024-10-25 07:12:07 +00:00
Stan Lo
60c0c324b2 [ruby/rdoc] Red-based darkfish color scheme
(https://github.com/ruby/rdoc/pull/1191)

* Cleanup rdoc.css

* Use red as the highlight color

* Use the same red as ruby-lang.org

* Make main section links stand out more

* Remove scrollbar styling

f69dc470ac
2024-10-23 22:36:27 +00:00
Mike Dalessio
0b38e18488 [ruby/rdoc] feature: Render mixed-in methods and constants with
`--embed-mixins`
(https://github.com/ruby/rdoc/pull/842)

* Embed mixed-in methods and constants with `--embed-mixins`

When `--embed-mixins` option is set:

- methods from an `extend`ed module are documented as singleton methods
- attrs from an `extend`ed module are documented as class attributes
- methods from an `include`ed module are documented as instance methods
- attrs from an `include`ed module are documented as instance attributes
- constants from an `include`ed module are documented

Sections are created when needed, and Darkfish's template annotates
each of these mixed-in CodeObjects. We also respect the mixin methods'
visibility.

This feature is inspired by Yard's option of the same name.

* Add comment to document why we set object visibility

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Add the mixin_from attribute to CodeObject's initializer

* Add test coverage for private mixed-in attributes.

---------

481c2ce660

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 20:40:34 +00:00
Stan Lo
fc11579c49 [ruby/rdoc] Use scroll-margin-top on anchor targets
(https://github.com/ruby/rdoc/pull/1190)

This will make the anchor target easier to read.

e2fe4882f4
2024-10-17 10:11:03 +00:00
Mads Ohm Larsen
1f0b540332 [ruby/rdoc] Add scroll-margin-top on all :target elements
(https://github.com/ruby/rdoc/pull/1174)

7398e5b0ad

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-10-17 10:10:36 +00:00
Vinicius Stock
ed993b5bcc [ruby/rdoc] Generate meta tags based on page's content
(https://github.com/ruby/rdoc/pull/1091)

716bc16a7d
2024-10-15 22:59:33 +00:00
Stan Lo
a778562f33 [ruby/rdoc] Make methods and attributes linkable
(https://github.com/ruby/rdoc/pull/1189)

* Use the same color for both class/module and method highlight

* Make methods and attributes linkable

7757fd9fe4
2024-10-10 16:09:44 +00:00
Stan Lo
c5f0fe1285 [ruby/rdoc] Improve method source toggling
(https://github.com/ruby/rdoc/pull/1176)

* Move method source block to the top

Currently, if a method description is long (e.g. `Array.new`), users need
to click the method toggle button next to the method title, and then scroll
down to the source code expanded below the description.

This commit changes the behavior so that the source code is expanded
immediately below the method title.

* Update method toggle's interface

1. Display the method toggle button by default instead of displaying on hover
2. Only toggle the source code when clicking the method toggle button, not
   when clicking the entire method title section. This will allow us to display
   an anchor link next to the method title
3. Simplify the toggle source button's appearance

* Use details tag for method toggling

* Rename method-click-advice to method-source-toggle

* Improve method controls' display on mobile

By moving the method controls out of the method header, we can display
them to the right of the method name on desktop, and below the method name
on mobile.

* Add "Example" label to example code blocks

The label should help users distinguish example code blocks from other
code blocks, such as method source code.

It's only applied to Ruby code examples.

* Revert "Add "Example" label to example code blocks"

This reverts commit 69fc9ce6a3.

* Give source code blocks a different background color

* Change targeted method's highlighting color to work better with the new method source

e608a84af3
2024-10-10 09:45:41 +00:00
Sam Bostock
c818606d84 [ruby/rdoc] Use normal font-weight for links
(https://github.com/ruby/rdoc/pull/1188)

b53f0cb2ed
2024-10-07 11:25:59 +00:00
tomoya ishida
218445bb1f [ruby/rdoc] Fix ToRdoc#accept_table
(https://github.com/ruby/rdoc/pull/1184)

7b68545094
2024-10-03 12:27:43 +00:00
Earlopain
5ed67f4826 [ruby/rdoc] Only let browser search through source code until it's
expanded
(https://github.com/ruby/rdoc/pull/1181)

Something that's been bothering me is that while the source code is
not visible by default, the browser still jump to it when searching.
Adding the `visible` property prevents this.

Test it out yourself:
* `bundle exec rdoc`
* open `_site/index.html`
* Search for `NameError`

Before, you will get a match from `load_yaml` source code, after
you only get the match when that methods source code is expanded.

003126cc23
2024-09-30 11:32:45 +00:00
Stan Lo
098649bc59 [ruby/rdoc] Add home page link to output message
(https://github.com/ruby/rdoc/pull/1165)

The link is clickable in the terminal and opens the home page in the browser

b7d580afab
2024-09-27 13:58:36 +00:00
Mads Ohm Larsen
ec5d5422ca [ruby/rdoc] Use pointer cursor for navigation toggle
(https://github.com/ruby/rdoc/pull/1175)

964a1982c8
2024-09-08 12:17:36 +00:00
Mads Ohm Larsen
6dc9384694 [ruby/rdoc] Add more space after magnifying glass
(https://github.com/ruby/rdoc/pull/1173)

6a9cad4c54
2024-09-06 21:26:17 +00:00
mterada1228
d4de8aef37 rake install command is failed (#1170)
* `rake install` command is failed

\### Problems

Several file paths were changed by following PR.

- 4211292ffe
- d7bca12c13

Because rdoc.gemspec doesn't take in this changes,
the `rake install` command is permanently failed.

\### Test

\#### before

```console
❯ bundle exec rake install
Running RuboCop...
Inspecting 4 files
....

4 files inspected, no offenses detected

Tip: Based on detected gems, the following RuboCop extension libraries
might be helpful:
  * rubocop-rake (https://rubygems.org/gems/rubocop-rake)

You can opt out of this message by adding the following to your config
(see
https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions
for more options):
  AllCops:
    SuggestExtensions: false
rake aborted!
Running `gem build -V
/Users/mterada/dev/redDataTools/remove_dependency/rdoc/rdoc.gemspec`
failed with the following output:

WARNING:  See https://guides.rubygems.org/specification-reference/ for
help
ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
    ["RI.rdoc", "lib/rdoc/alias.rb", "lib/rdoc/anon_class.rb",
"lib/rdoc/any_method.rb", "lib/rdoc/attr.rb",
"lib/rdoc/class_module.rb", "lib/rdoc/constant.rb",
"lib/rdoc/context.rb", "lib/rdoc/context/section.rb",
"lib/rdoc/extend.rb", "lib/rdoc/ghost_method.rb", "lib/rdoc/include.rb",
"lib/rdoc/meta_method.rb", "lib/rdoc/method_attr.rb",
"lib/rdoc/mixin.rb", "lib/rdoc/normal_class.rb",
"lib/rdoc/normal_module.rb", "lib/rdoc/require.rb",
"lib/rdoc/single_class.rb", "lib/rdoc/top_level.rb"] are not files

/Users/mterada/.rbenv/versions/3.1.0/bin/bundle:25:in `load'
/Users/mterada/.rbenv/versions/3.1.0/bin/bundle:25:in `<main>'
Tasks: TOP => install => build
(See full trace by running task with --trace)
```

\#### after

```console
❯ bundle exec rake install
Running RuboCop...
Inspecting 4 files
....

4 files inspected, no offenses detected

Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-rake (https://rubygems.org/gems/rubocop-rake)

You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
  AllCops:
    SuggestExtensions: false
rdoc 6.7.0 built to pkg/rdoc-6.7.0.gem.
rdoc (6.7.0) installed.
```

* Add a `bundle exec rake install` step to github workflow

* make intentionally CI failed

* Revert "make intentionally CI failed"

This reverts commit 9fc5dd9423a024594ad26d86a8a6af829e7017f8.
2024-09-05 16:53:31 +00:00
Stan Lo
ec61dbd98e [ruby/rdoc] Make darkfish more responsive and readable on mobile
devices
(https://github.com/ruby/rdoc/pull/1162)

- Make the sidebar toggle fixed on all devices
- Prevent default zooming on mobile devices
- Improve sidebar opening on mobile devices

95b6cfb64f
2024-08-26 22:02:33 +00:00
Ufuk Kayserilioglu
519152db6d [ruby/rdoc] Make the summary triangle appear in the correct place
when the summary text overflows to next line.
(https://github.com/ruby/rdoc/pull/1160)

f2eb62f6f8
2024-08-24 18:15:21 +00:00
Stan Lo
6717b69067 [ruby/rdoc] Modernize RDoc Darkfish template CSS
(https://github.com/ruby/rdoc/pull/1157)

- Update color scheme with muted green tones and improved contrast
- Enhance readability by adjusting font sizes and weights
- Improve code block styling with a light gray background
- Refactor layout for better responsiveness and sidebar presentation
- Standardize link styles across the document
- Implement CSS variables for easier theme customization
- Adjust heading styles for better visual hierarchy
- Enhance table and list styling for improved readability
- Optimize search field and navigation toggle appearance
- Improve method detail and documentation section styling
- Reorganize css and overhaul the sidebar design
- Improve code block's syntax highlighting

6cde9edadb
2024-08-24 11:07:28 +00:00
Hiroshi SHIBATA
592b90328a
Generate parsers of RDoc with Racc 1.8.1 2024-08-21 13:30:01 +09:00
David Rodríguez
786d000652 [ruby/rdoc] Avoid potentially loading the same extension from different versions of the same gem
Avoids warnings like

```
/path/to/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rbs-3.4.0/lib/rdoc/discover.rb:10: warning: method redefined; discarding old scan
/path/to/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rbs-3.5.1/lib/rdoc/discover.rb:10: warning: previous definition of scan was here
```

e47920d8f3
2024-08-19 11:48:42 +00:00
Stan Lo
923e36ab21 [ruby/rdoc] Fix sidebar scroll again and add missing footer back
(https://github.com/ruby/rdoc/pull/1154)

* Add missing footers

In #1152 the footer partial was only added to the index.rhtml file.
This commit adds the footer partial to the other template files.

* Remove unnecessary middle divs in nav

* Simplify sidebar's overflow settings

Because sidebar needs to be scrollable, its overflow should default to auto.
Currently it's set to hidden and force individual elements to set overflow auto,
which overcomplicates things.

b8c2bcd8db
2024-08-15 13:33:00 +00:00
Stan Lo
908305a297 Sync rdoc 2024-08-13 09:10:15 -04:00
Stan Lo
64a7b87e1d
Sync rdoc to fix master doc's display issue (#11345)
Sync rdoc

This syncs changes made in https://github.com/ruby/rdoc/pull/1148, which
will fix https://docs.ruby-lang.org/en/master/'s display on certain screens.
2024-08-08 13:02:46 -07:00
tompng
8d39939107 [ruby/rdoc] Use ascii chatacter in HTML file
40a6690010
2024-08-08 08:54:52 +09:00
Stan Lo
cbc40bb130 Sync rdoc 2024-08-05 08:27:45 +08:00
tomoya ishida
16b0242808 [ruby/rdoc] Add new ruby parser that uses Prism
(https://github.com/ruby/rdoc/pull/1144)

* Add a new ruby parser RDoc::Parser::PrismRuby

* Add a new ruby parser testcase independent from parser's internal implementation

* unknown meta method

* Use MethodSignatureVisitor only to scan params, block_params and calls_super

* Add calls_super test

* Drop ruby 2.6. Prism requires ruby >= 2.7

* Remove duplicated documentation comment from prism_ruby.rb

* Add test for wrong argument passed to metaprogramming method

* Rename visit_call_[DSL_METHOD_NAME] to make it distinguishable from visit_[NODE_TYPE]_node

* Method receiver switch of true/false/nil to a case statement

* Extract common part of add_method(by def keyword) and add meta_comment method

* Reuse consecutive comments array when collecting comments

* Simplify DSL call_node handling

* Refactor extracting method visibility arguments

fde99f1be6
2024-07-31 20:50:00 +00:00
Stan Lo
27c22f822a [ruby/rdoc] Drop unnecessary file_name parameter from Parser.for
method.
(https://github.com/ruby/rdoc/pull/1135)

* Unify top_level creation in tests

* Remove unnecessary file_name param from Parser.for

It should be always the same as the top_level's absolute_name, so there's
no point of taking it as a separate parameter.

97c497dfbb
2024-07-31 14:36:41 +00:00
Burdette Lamar
63bdf2d725 [ruby/rdoc] [DOC] Mods about markup formats
(https://github.com/ruby/rdoc/pull/1143)

011de3f2fd
2024-07-29 13:16:18 +00:00
Hartley McGuire
d0c17cbd09
Require space between hash/content in ATX heading (#1140)
While writing some Markdown documentation for Rails, I came across an
interesting case where trying to link to an instance method at the start
of a line would instead parse as an H1 heading:

```markdown
#response_body=
```

Expected:

```html
<a href=""><code>#response_body=</code></a>
```

Actual:

```html
<h1>response_body=</h1>
```

According to the CommonMark spec:

> At least one space or tab is required between the # characters and the
> heading’s contents, unless the heading is empty. Note that many
> implementations currently do not require the space. However, the space
> was required by the original ATX implementation, and it helps prevent
> things like the following from being parsed as headings:
>
> Example 64

So while some implementations do not follow this requirement, I believe
RDoc should because it makes it easy to write text similar to Example 64
(which was used in the new test) and it also enables automatically
linking to instance methods at the start of a line.
2024-07-18 09:40:01 +09:00
Stan Lo
239d54dfbc [ruby/rdoc] Improve rubocop setup
(https://github.com/ruby/rdoc/pull/1139)

* Rename rake rubocop to rake format_generated_files

* Add rubocop rules to ensure spaces are applied consistently

* Improve rubocop related CI workflows

27932d001c
2024-07-17 20:43:08 +00:00
nicholas a. evans
e165d92d37
[ruby/rdoc] Drop reimplementation of Ripper lex state
(https://github.com/ruby/rdoc/pull/1118)

* Drop reimplementation of Ripper lex state

This code was for ruby 2.4 compatibility, but rdoc dropped support for
ruby 2.4 about three years ago, in f480b970c.  This code was almost half
of the lines of code in rdoc/parser/ripper_state_lex.

* Remove unused Ripper constants and const_defined?

This was mostly copied from the diff in @st0012's PR comment.  The
remaining constants have been updated to get their value directly from
Ripper.

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Use Ripper::EXPR_LABEL directly

Since this is only used from outside RipperStateLex, there's no longer
any benefit to using the indirect reference rather than just going
straight to Ripper.

---------

dd8c216263

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-07-16 07:22:11 +09:00
Stan Lo
d7af8afe1b [ruby/rdoc] Group code object files into the same directory
(https://github.com/ruby/rdoc/pull/1114)

It's hard to distinguish code object classes by their file names alone.
And given that we have 18 such classes, it'd make the codebase a lot
easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in `lib/rdoc.rb` instead
of required individually, this change should have minimum impact on
projects using RDoc as they generally just require `rdoc`, not individual
files. An example is Rails' `sdoc`:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb

4211292ffe
2024-07-02 10:15:00 +00:00