File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,37 @@ npx stylelint "lib/rdoc/generator/template/aliki/css/rdoc.css"
8282- Style and formatting checks
8383- Many issues auto-fixable with ` --fix `
8484
85+ ### Type annotations
86+
87+ Annotate method types using [ Sorbet flavored RBS] ( https://sorbet.org/docs/rbs-support ) in inline comments.
88+ For more information about RBS syntax, see the [ documentation] ( https://github.com/ruby/rbs/blob/master/docs/syntax.md ) .
89+
90+ A few examples:
91+
92+ ``` ruby
93+ # Method that receives an integer and doesn't return anything
94+ # : (Integer) -> void
95+ def foo (something ); end
96+
97+ # Method that receives a string and returns an integer
98+ # : (String) -> Integer
99+ def bar (something )
100+ 123
101+ end
102+
103+ # Method that doesn't accept arguments and returns a hash of symbol to string
104+ # : () -> Hash[Symbol, String]
105+ def bar
106+ { key: " value" }
107+ end
108+
109+ # Method that accepts a block, which yields a single integer argument and returns whatever the block returns
110+ # : [T] () { (Integer) -> T } -> T
111+ def bar
112+ yield (5 )
113+ end
114+ ```
115+
85116### Documentation Generation
86117
87118``` bash
Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ npm run lint:css
8686npm run lint:css -- --fix
8787```
8888
89+ ## Type annotations
90+
91+ RDoc is currently not a typed codebase. Despite not running a type checker, contributors have been
92+ adding some comment annotations to make the codebase easier to navigate and understand.
93+
94+ These annotations use [ Sorbet flavored RBS] ( https://sorbet.org/docs/rbs-support ) annotations,
95+ so that we can tag definitions as abstract and override. For more information on RBS syntax,
96+ see the [ documentation] ( https://github.com/ruby/rbs/blob/master/docs/syntax.md ) .
97+
8998## Parser Generation
9099
91100RDoc uses generated parsers for Markdown and RD formats.
You can’t perform that action at this time.
0 commit comments