Class: GrapeSwagger::DocMethods::OperationId
- Inherits:
-
Object
- Object
- GrapeSwagger::DocMethods::OperationId
- Defined in:
- lib/grape-swagger/doc_methods/operation_id.rb
Class Method Summary collapse
Class Method Details
.build(method = nil, path = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/grape-swagger/doc_methods/operation_id.rb', line 5 def build(method = nil, path = nil) verb = method.to_s.downcase operation = manipulate(path) unless path.nil? "#{verb}#{operation}" end |
.manipulate(path) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/grape-swagger/doc_methods/operation_id.rb', line 13 def manipulate(path) operation = path.split('/').map(&:capitalize).join 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 |