Sha256: f0080ee462d8627230e1d343bcdfc8e3ecac10fa9f860e61e5aee18c27dd6d2a
Contents?: true
Size: 960 Bytes
Versions: 12
Compression:
Stored size: 960 Bytes
Contents
# frozen_string_literal: true module GrapeSwagger module DocMethods class OperationId class << self def build(route, path = nil) if route.options[:nickname] route.options[:nickname] else verb = route.request_method.to_s.downcase operation = manipulate(path) unless path.nil? "#{verb}#{operation}" end end def manipulate(path) operation = path.split('/').map(&:capitalize).join operation.gsub!(/\-(\w)/, &:upcase).delete!('-') if operation[/\-(\w)/] operation.gsub!(/\_(\w)/, &:upcase).delete!('_') if operation.include?('_') operation.gsub!(/\.(\w)/, &:upcase).delete!('.') if operation.include?('.') if path.include?('{') operation.gsub!(/\{(\w)/, &:upcase) operation.delete!('{').delete!('}') end operation end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems