Skip to content

Commit 9fda24b

Browse files
Merge pull request #66 from swistaczek/master
fix for empty captures
2 parents ccdc6fa + ff09ee6 commit 9fda24b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Gemfile.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ GEM
99
coderay (1.0.7)
1010
descendants_tracker (0.0.1)
1111
diff-lcs (1.1.3)
12+
ffi (1.9.3-java)
1213
git (1.2.5)
1314
grape (0.5.0)
1415
activesupport
@@ -31,6 +32,7 @@ GEM
3132
rake
3233
rdoc
3334
json (1.7.3)
35+
json (1.7.3-java)
3436
kramdown (0.13.7)
3537
method_source (0.8)
3638
multi_json (1.7.7)
@@ -39,6 +41,11 @@ GEM
3941
coderay (~> 1.0.5)
4042
method_source (~> 0.8)
4143
slop (~> 3.3.1)
44+
pry (0.9.10-java)
45+
coderay (~> 1.0.5)
46+
method_source (~> 0.8)
47+
slop (~> 3.3.1)
48+
spoon (~> 0.0)
4249
rack (1.5.2)
4350
rack-accept (0.4.5)
4451
rack (>= 0.4)
@@ -64,11 +71,14 @@ GEM
6471
shoulda-matchers (1.2.0)
6572
activesupport (>= 3.0.0)
6673
slop (3.3.2)
74+
spoon (0.0.4)
75+
ffi
6776
virtus (0.5.5)
6877
backports (~> 3.3)
6978
descendants_tracker (~> 0.0.1)
7079

7180
PLATFORMS
81+
java
7282
ruby
7383

7484
DEPENDENCIES

lib/grape-swagger.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ def add_swagger_documentation(options={})
1313

1414
@combined_routes = {}
1515
routes.each do |route|
16-
resource = route.route_path.split(route.route_prefix).last.match('\/([\w|-]*?)[\.\/\(]').captures.first
16+
route_match = route.route_path.split(route.route_prefix).last.match('\/([\w|-]*?)[\.\/\(]')
17+
next if route_match.nil?
18+
resource = route_match.captures.first
1719
next if resource.empty?
1820
resource.downcase!
1921
@combined_routes[resource] ||= []

0 commit comments

Comments
 (0)