Module: Grape::DSL::Desc
Instance Attribute Summary
Attributes included from Settings
Instance Method Summary collapse
-
#desc(description, **options) { ... } ⇒ Object
Add a description to the next namespace or function.
Methods included from Settings
global_setting, namespace_setting, route_setting, top_level_setting
Instance Method Details
#desc(description, **options) { ... } ⇒ Object
Add a description to the next namespace or function.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/grape/dsl/desc.rb', line 56 def desc(description, **, &config_block) = if .key?(:default) Grape.deprecator.warn('The `default` option of `desc` is deprecated. Use `default_response` instead.') # Rebuilt rather than mutated in place: an explicit +default_response+ # still wins, since the merged Hash is the one that keeps its key. { default_response: [:default] }.merge(.except(:default)) else end settings = if config_block endpoint_config = defined?(configuration) ? configuration : nil Grape::Util::ApiDescription.new(description, endpoint_config, &config_block).settings else .merge(description:) end # Only the route scope is consumed downstream (by +route+ and the # route's readers, e.g. +http_codes+); the namespace scope was # write-only, so it is no longer populated. inheritable_setting.route_description = settings end |