Class: RailsOpenapiGen::Parsers::QueryParser

Inherits:
Object
  • Object
show all
Includes:
BaseAttributeParser
Defined in:
lib/rails-openapi-gen/parsers/comment_parsers/query_parser.rb

Constant Summary collapse

REGEX =
/@openapi_query\s+(.+)$/

Instance Method Summary collapse

Instance Method Details

#parse(comment_text) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rails-openapi-gen/parsers/comment_parsers/query_parser.rb', line 12

def parse(comment_text)
  match = comment_text.match(REGEX)
  return nil unless match

  openapi_content = match[1].strip
  { query_parameter: parse_parameter_attributes(openapi_content) }
end