Class: GrapeSwagger::DocMethods::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/grape-swagger/doc_methods/headers.rb

Class Method Summary collapse

Class Method Details

.parse(route) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/grape-swagger/doc_methods/headers.rb', line 7

def parse(route)
  route.headers.to_a.map do |route_header|
    route_header.tap do |header|
      hash = header[1]
      description = hash.delete('description')
      hash[:documentation] = { desc: description, in: 'header' }
      hash[:type] = hash['type'].titleize if hash['type']
    end
  end
end