module OasRails::Extractors::RenderResponseExtractor

def parse_hash_structure(hash_literal)

Returns:
  • (Hash) - A hash representing the structure of the input.

Parameters:
  • hash_literal (String) -- The hash literal string.
def parse_hash_structure(hash_literal)
  structure = {}
  hash_literal.scan(/(\w+):\s*(\S+)/) do |key, value|
    structure[key.to_sym] = case value
                            when 'true', 'false'
                              'Boolean'
                            when /^\d+$/
                              'Number'
                            else
                              'Object'
                            end
  end
  structure
end