Removed unused methods and paths.

This commit is contained in:
dB 2014-12-01 09:34:46 -05:00
parent d155810667
commit e9c3f2c76b
2 changed files with 4 additions and 17 deletions

View File

@ -298,14 +298,6 @@ module Grape
end
end
def try(*args, &block)
if args.empty? && block_given?
yield self
elsif respond_to?(args.first)
public_send(*args, &block)
end
end
def strip_heredoc(string)
indent = string.scan(/^[ \t]*(?=\S)/).min.try(:size) || 0
string.gsub(/^[ \t]{#{indent}}/, '')
@ -455,14 +447,7 @@ module Grape
if route.route_entity
type = @@documentation_class.parse_entity_name(route.route_entity)
if route.instance_variable_get(:@options)[:is_array]
operation.merge!(
'type' => 'array',
'items' => generate_typeref(type)
)
else
operation.merge!('type' => type)
end
operation.merge!('type' => type)
end
operation[:nickname] = route.route_nickname if route.route_nickname

View File

@ -6,6 +6,7 @@ describe 'API Models' do
module Entities
class Something < Grape::Entity
expose :text, documentation: { type: 'string', desc: 'Content of something.' }
expose :links, documentation: { type: 'link', is_array: true }
end
end
@ -241,7 +242,8 @@ describe 'API Models' do
expect(result['models']['Something']).to eq(
'id' => 'Something',
'properties' => {
'text' => { 'type' => 'string', 'description' => 'Content of something.' }
'text' => { 'type' => 'string', 'description' => 'Content of something.' },
'links' => { 'type' => 'array', 'items' => { '$ref' => 'link' } }
}
)
end