如果我使用grape
构建http api,如下面的ruby代码:
module Twitter
class API < Grape::API
helpers do
def current_user
@current_user ||= User.authorize!(env)
end
def authenticate!
error!('401 Unauthorized', 401) unless current_user
end
end
resource :statuses do
desc 'Return a public timeline.'
get :public_timeline do
...
end
desc 'Return a personal timeline.'
get :home_timeline do
...
end
desc 'Create a status.'
post do
...
end
desc 'Update a status.'
put ':id' do
...
end
desc 'Delete a status.'
delete ':id' do
...
end
end
end
end
我希望vim tagbar
插件显示生成正确的结构,但不是,如下面的截图:
它只将def
视为代码的结构。如何将标记栏视为resource
,dsec
作为结构?