Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1d787b38
Commit
1d787b38
authored
Oct 26, 2020
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only expose needed methods from API::Base
parent
2a9401dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
lib/api/base.rb
lib/api/base.rb
+17
-13
No files found.
lib/api/base.rb
View file @
1d787b38
...
...
@@ -4,15 +4,16 @@ module API
class
Base
<
Grape
::
API
::
Instance
# rubocop:disable API/Base
include
::
Gitlab
::
WithFeatureCategory
def
self
.
feature_category_for_app
(
app
)
class
<<
self
def
feature_category_for_app
(
app
)
feature_category_for_action
(
path_for_app
(
app
))
end
def
self
.
path_for_app
(
app
)
def
path_for_app
(
app
)
normalize_path
(
app
.
namespace
,
app
.
options
[
:path
].
first
)
end
def
self
.
route
(
methods
,
paths
=
[
'/'
],
route_options
=
{},
&
block
)
def
route
(
methods
,
paths
=
[
'/'
],
route_options
=
{},
&
block
)
if
category
=
route_options
.
delete
(
:feature_category
)
feature_category
(
category
,
Array
(
paths
).
map
{
|
path
|
normalize_path
(
namespace
,
path
)
})
end
...
...
@@ -20,8 +21,11 @@ module API
super
end
def
self
.
normalize_path
(
namespace
,
path
)
private
def
normalize_path
(
namespace
,
path
)
[
namespace
.
presence
,
path
.
to_s
.
chomp
(
'/'
).
presence
].
compact
.
join
(
'/'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment