Sha256: eace7ccd7d6cd481a0ae3e7a41b3cba680e29fd2e5cf836d834e7fd3e7e929c7
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
module GrapeSwagger module DocMethods class PathString class << self def build(path, options = {}) # always removing format path.sub!(/\(\.\w+?\)$/, '') path.sub!('(.:format)', '') # ... format path params path.gsub!(/:(\w+)/, '{\1}') # set item from path, this could be used for the definitions object item = path.gsub(%r{/{(.+?)}}, '').split('/').last.singularize.underscore.camelize || 'Item' if options[:version] && options[:add_version] path.sub!('{version}', options[:version].to_s) else path.sub!('/{version}', '') end path = "#{GrapeSwagger::DocMethods::OptionalObject.build(:base_path, options)}#{path}" if options[:add_base_path] [item, path.start_with?('/') ? path : "/#{path}"] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-swagger-0.20.3 | lib/grape-swagger/doc_methods/path_string.rb |