-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(yard): parse docs inside included, intance_methods and class_me…
…thods blocks
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require "yard" | ||
|
||
## | ||
# This file is used to allow parsing of yard docs inside `included`, `instance_methods` and `class_methods` blocks. | ||
# | ||
# It is loaded by the `RUBYLIB` ENV variable passed to `task docs:generate` in `Taskfile`. | ||
# | ||
# @see https://rubydoc.info/gems/yard/file/docs/GettingStarted.md#plugin-support | ||
# @see https://github.com/digitalcuisine/yard-activesupport-concern | ||
# @see https://github.com/digitalcuisine/yard-activesupport-concern/blob/v0.0.1/lib/yard-activesupport-concern.rb | ||
# @see https://stackoverflow.com/a/901109/12201472 | ||
# | ||
module YARD | ||
module Concern | ||
class IncludedHandler < YARD::Handlers::Ruby::Base | ||
handles method_call(:included) | ||
|
||
namespace_only | ||
|
||
def process | ||
parse_block(statement.last.last, namespace: namespace, scope: :instance) | ||
end | ||
end | ||
|
||
class InstanceMethodsHandler < YARD::Handlers::Ruby::Base | ||
handles method_call(:instance_methods) | ||
|
||
namespace_only | ||
|
||
def process | ||
parse_block(statement.last.last, namespace: namespace, scope: :instance) | ||
end | ||
end | ||
|
||
class ClassMethodsHandler < YARD::Handlers::Ruby::Base | ||
handles method_call(:class_methods) | ||
|
||
namespace_only | ||
|
||
def process | ||
parse_block(statement.last.last, namespace: namespace, scope: :class) | ||
end | ||
end | ||
end | ||
end |