diff options
author | aycabta <aycabta@gmail.com> | 2021-06-29 20:01:46 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-07-05 11:34:29 +0900 |
commit | caa123b50e12c5ea95763d7661adb6096e48df21 (patch) | |
tree | 9d52cf3f968289d64dd2eb44f23dde4444de18f3 /lib/rdoc | |
parent | 2f3edf28f3a251bac2cf3b47b46b372faac71e8e (diff) |
[ruby/rdoc] Support ActiveSupport::Concern.included
ref. https://github.com/rails/rails/blob/168ddaa08a63cd956bb7c3ba10be1a7ae36d4ee2/activerecord/lib/active_record/core.rb#L9-L20
https://github.com/ruby/rdoc/commit/a2d651dade
Co-authored-by: Fumiaki MATSUSHIMA <mtsmfm@gmail.com>
Diffstat (limited to 'lib/rdoc')
-rw-r--r-- | lib/rdoc/parser/ruby.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8d021f3c6d..e546fe2141 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1194,6 +1194,22 @@ class RDoc::Parser::Ruby < RDoc::Parser end ## + # Parses an +included+ with a block feature of ActiveSupport::Concern. + + def parse_included_with_activesupport_concern container, comment # :nodoc: + skip_tkspace_without_nl + tk = get_tk + unless tk[:kind] == :on_lbracket || (tk[:kind] == :on_kw && tk[:text] == 'do') + unget_tk tk + return nil # should be a block + end + + parse_statements container + + container + end + + ## # Parses identifiers that can create new methods or change visibility. # # Returns true if the comment was not consumed. @@ -1893,6 +1909,8 @@ class RDoc::Parser::Ruby < RDoc::Parser parse_extend_or_include RDoc::Include, container, comment when "extend" then parse_extend_or_include RDoc::Extend, container, comment + when "included" then + parse_included_with_activesupport_concern container, comment end else |