File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -650,13 +650,13 @@ Parameters can also be tagged to the method declaration itself.
650650
651651``` ruby
652652class StringAPI < Grape ::API
653- get " split/:string" , { :params => [ " token" ] , :optional_params => [ " limit" ] } do
653+ get " split/:string" , { :params => { " token" => " a token " } , :optional_params => { " limit" => " the limit " } } do
654654 params[:string ].split(params[:token ], (params[:limit ] || 0 ))
655655 end
656656end
657657
658- StringAPI ::routes[0 ].route_params # yields an array [ "string", "token" ]
659- StringAPI ::routes[0 ].route_optional_params # yields an array [ "limit" ]
658+ StringAPI ::routes[0 ].route_params # yields a hash { "string" => "" , "token" => "a token"}
659+ StringAPI ::routes[0 ].route_optional_params # yields a hash { "limit" => "the limit"}
660660```
661661
662662It's possible to retrieve the information about the current route from within an API call with ` route ` .
You can’t perform that action at this time.
0 commit comments