doc_my_routes 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f789a0b78d494649c621e36704e917d37d72cf5
4
- data.tar.gz: 6374b29644c863962118ce3c76d0eecfff645a66
3
+ metadata.gz: 5754250c62eeed9d55718249942377648af6d039
4
+ data.tar.gz: 88aa69f93adc8ed23b07a4fff9526f4cc70daeec
5
5
  SHA512:
6
- metadata.gz: 61418fb9e733596422b95254798a1885b91411be88fdae64a8369d6790d7848797cbca11bc6e72dbd2b183b2897cc85e9dd9a2eeef7d2577432b4b1396521118
7
- data.tar.gz: 05b3f7978092608493e1c189cec8d1b1974bcbd541f3d7a092e61ada04eb8db64ace13ce688c1f49fce7d3d02b8cc017a15c5c4e7d36fc7213ccfa02b097e9d8
6
+ metadata.gz: 77eeab5d932ec11aa670ee4defc0ce9787d0da9b9c7632513aad36c1dbb31984de99e9bf651ebbc73c253e22b54a0df1f0c0a981b78a7b98f8e4c6a68dc3c9d8
7
+ data.tar.gz: 224a8c919c47995a4263b6865b4e60b01dd4bcba6a8424b1c72a33f30eed84e5aca3d0bcfe774209c56641dde758585d22a62e847b993cd44252561634f7828a
@@ -18,10 +18,21 @@ module DocMyRoutes
18
18
  # features are enabled
19
19
  def extended(mod)
20
20
  # Wrap sinatra's route method to register the defined routes
21
- mod.define_singleton_method(:route) do
22
- |verb, route_pattern, conditions = {}, &block|
23
- result = super(verb, route_pattern, conditions, &block)
24
- track_route(self, verb, route_pattern, conditions)
21
+ mod.define_singleton_method(:route) do |*args, &block|
22
+ result = super(*args, &block)
23
+
24
+ options = args.last.is_a?(Hash) ? args.pop : {}
25
+ routes = [*args.pop].map(&:to_s) # ensure routes are strings
26
+ verbs = args.map { |verb| verb.is_a?(Symbol) ? verb.to_s.upcase : verb }
27
+
28
+ verbs.each do |verb|
29
+ routes.each do |route_pattern|
30
+ reset_doc = verb.equal?(verbs.last) && route_pattern.equal?(routes.last)
31
+
32
+ track_route(self, verb, route_pattern, options, reset_doc, &block)
33
+ end
34
+ end
35
+
25
36
  result
26
37
  end
27
38
 
@@ -93,7 +104,7 @@ module DocMyRoutes
93
104
 
94
105
  private
95
106
 
96
- def track_route(resource, verb, route_pattern, conditions)
107
+ def track_route(resource, verb, route_pattern, conditions, reset_doc)
97
108
  unless route_documentation.hidden? || skip_route(verb)
98
109
  route = Route.new(resource, verb, route_pattern, conditions,
99
110
  route_documentation)
@@ -102,7 +113,7 @@ module DocMyRoutes
102
113
  end
103
114
 
104
115
  # Ensure values are reset
105
- reset_doc_values
116
+ reset_doc_values if reset_doc
106
117
  end
107
118
 
108
119
  # The summary, notes and status codes are only valid for one route
@@ -1,4 +1,4 @@
1
1
  # DocMyRoutes version
2
2
  module DocMyRoutes
3
- VERSION = '0.12.0'
3
+ VERSION = '0.13.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doc_my_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Workday, Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sinatra-contrib
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: nokogiri
99
113
  requirement: !ruby/object:Gem::Requirement