Module: OpenApi::Tags::Controller::ClassMethods
- Defined in:
- lib/open-api/tags.rb
Instance Method Summary collapse
- #open_api_tag(tag, metadata = nil) ⇒ Object
- #open_api_tag_metadata(tag, opts = {}) ⇒ Object
- #open_api_tags(metadata = nil) ⇒ Object
Instance Method Details
#open_api_tag(tag, metadata = nil) ⇒ Object
123 124 125 126 127 128 129 130 131 |
# File 'lib/open-api/tags.rb', line 123 def open_api_tag(tag, = nil) fail 'Valid tag argument required!' unless tag.respond_to?(:to_s) return ( || {})[tag.to_s].deep_dup if .blank? fail 'Expected Hash argument for open_api_tag()!' unless .is_a?(Hash) = { name: tag.to_s }.merge() unless .include?(:name) = (( ||= {})[tag.to_s] ||= {}) OpenApi::Tags.(, ) nil end |
#open_api_tag_metadata(tag, opts = {}) ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/open-api/tags.rb', line 133 def (tag, opts = {}) controller_class_hierarchy = OpenApi::Utils.controller_class_hierarchy(self) = {} controller_class_hierarchy.each do |controller_class| OpenApi::Tags.(, controller_class.send(:open_api_tag, tag), opts) end end |
#open_api_tags(metadata = nil) ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/open-api/tags.rb', line 115 def ( = nil) return ( || {}).deep_dup if .blank? fail 'Expected Hash argument for open_api_tags()!' unless .is_a?(Hash) .each { |tag, | open_api_tag(tag, ) } ( || {}) nil end |