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

YARD doc DSL handler #2

Open
SleeplessByte opened this issue Oct 4, 2018 · 0 comments
Open

YARD doc DSL handler #2

SleeplessByte opened this issue Oct 4, 2018 · 0 comments
Labels
💎 feature New feature

Comments

@SleeplessByte
Copy link
Owner

SleeplessByte commented Oct 4, 2018

Description

YARD needs custom handlers to pickup our DSL and automagically document it.

Proposed Solution

Add handler so that the following may be generated:

# @!method to_constructable
#   Returns the construtable media type
#
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable ::MediaTypes::Constructable
#   @return [::MediaTypes::Constructable] a constructable
#
media_type 'x'
# @!method valid?(data, constructed_media_type, **opts)
#   Validates the +data+ against the validation for +constructed_media_type+.
#
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#valid%3F-instance_method ::MediaTypes::Scheme#valid?
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#valid%3F-instance_method ::MediaTypes::Constructable#valid?
#
#   @param [Object] data the data to validate
#   @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
#   @param [Hash] opts passed on to {::MediaTypes::Scheme#valid?}
#
#   @return [TrueClass, FalseClass] true if valid, false otherwise
#
# @!method validate!(data, constructed_media_type, **opts)
#   Validates the +data+ against the validation for +constructed_media_type+. Raises if invalid
#
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#validate-instance_method ::MediaTypes::Scheme#validate
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#validate!-instance_method ::MediaTypes::Constructable#validate!
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme/ValidationError ::MediaTypes::Scheme::ValidationError
#
#   @param [Object] data the data to validate
#   @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
#   @param [Hash] opts passed on to {::MediaTypes::Scheme#validate}
#
#   @raise ::MediaTypes::Scheme::ValidationError an error if the scheme is not valid
#   @return [TrueClass] true if valid
#
validations do
end
# @!method register
#   Registers all the known permutations of versions, views, suffixes and aliases for this media type via
#   {::MediaTypes.register}
#
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes#register-class-method ::Mediatypes.register
#   @see https://www.rubydoc.info/gems/media_types/MediaTypes/Registerable ::Mediatypes::Registerable
#
#   @return [Array<::MediaTypes::Registerable>]
registrations :x do
end

Additional Context

https://yardoc.org/guides/extending-yard/writing-handlers.html

@SleeplessByte SleeplessByte added the 💎 feature New feature label Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 feature New feature
Projects
None yet
Development

No branches or pull requests

1 participant