Skip to content

Commit 78d5fdc

Browse files
committed
BONUS: Got rid of the only lint violation by moving code above a private block. The method is a class method that shouldn't be under the private methods section anyways
1 parent 1a4606d commit 78d5fdc

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
10-
Lint/IneffectiveAccessModifier:
11-
Exclude:
12-
- 'lib/grape/router.rb'
13-
149
# Offense count: 39
1510
Metrics/AbcSize:
1611
Max: 44

lib/grape/router.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def initialize(pattern, attributes = {})
1111
end
1212
end
1313

14+
def self.normalize_path(path)
15+
path = "/#{path}"
16+
path.squeeze!('/')
17+
path.sub!(%r{/+\Z}, '')
18+
path = '/' if path == ''
19+
path
20+
end
21+
1422
def initialize
1523
@neutral_map = []
1624
@map = Hash.new { |hash, key| hash[key] = [] }
@@ -149,13 +157,5 @@ def routes_for(method)
149157
def string_for(input)
150158
self.class.normalize_path(input)
151159
end
152-
153-
def self.normalize_path(path)
154-
path = "/#{path}"
155-
path.squeeze!('/')
156-
path.sub!(%r{/+\Z}, '')
157-
path = '/' if path == ''
158-
path
159-
end
160160
end
161161
end

0 commit comments

Comments
 (0)