lotus-router 0.5.0 → 0.5.1

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: 385192d4a396ff6a0e91dabff73a8351c55848ed
4
- data.tar.gz: efd06ad2632579b10f7cf6229aba7b3d760fbc08
3
+ metadata.gz: 3cd44d51062b33daa31392d80c9716b54046dc6e
4
+ data.tar.gz: 2bc1433d02365b6a3d2c2261eb07c2d06a278d4d
5
5
  SHA512:
6
- metadata.gz: a0c1078e04043023b44f1a72189e6890dd8e1ccfa53f966bb6624527f2444fa5825ede6944e17c0b171b2eecf393cb1f39573e65073a74b512813114c37a00e0
7
- data.tar.gz: 662945b950952171f02220b318e808b87c44ad44b54034defff58772fd30f92d3ab9036737433888ae06c2b8be07ccbb52d6e4f1f8d739c2f33dffb5e1281d01
6
+ metadata.gz: 632672c9d814633ffeb835a9e2e936dd3087a3a4b1c5f178e68ec364ea32c5ac8617c5b67cd830aa5a6ad535c1e0e3e97e170f2024e3f9309f0a9522bef96aa3
7
+ data.tar.gz: 3322995dd718005424de21ac6c11ac3b0cc24b9d5b532adf11243a7b0ba5f1896984288737641fa783273ed5498f9e3c4ad1798b7be60be32f66a0f63d51c818
@@ -1,6 +1,9 @@
1
1
  # Lotus::Router
2
2
  Rack compatible HTTP router for Ruby
3
3
 
4
+ ## v0.5.1 - 2016-01-19
5
+ - [Anton Davydov] Print stacked lines for routes inspection
6
+
4
7
  ## v0.5.0 - 2016-01-12
5
8
  ### Added
6
9
  - [Luca Guidi] Added `Lotus::Router#recognize` as a testing facility. Example `router.recognize('/') # => associated route`
@@ -1,6 +1,6 @@
1
1
  module Lotus
2
2
  class Router
3
3
  # @since 0.1.0
4
- VERSION = '0.5.0'.freeze
4
+ VERSION = '0.5.1'.freeze
5
5
  end
6
6
  end
@@ -135,7 +135,25 @@ module Lotus
135
135
  # | GET, HEAD | | /api/second_mount/comments | Comments::Index |
136
136
  def to_s(formatter = FORMATTER, base_path = nil)
137
137
  base_path = Utils::PathPrefix.new(base_path)
138
- result = ''
138
+
139
+ inspect_routes(formatter, base_path)
140
+ .insert(0, formatter % INSPECTOR_HEADER_HASH + EMPTY_LINE)
141
+ end
142
+
143
+ # Returns a string representation of routes
144
+ #
145
+ # @param formatter [String] the template for the output
146
+ # @param base_path [Lotus::Utils::PathPrefix] the base path
147
+ #
148
+ # @return [String] serialized routes from router
149
+ #
150
+ # @since 0.5.1
151
+ # @api private
152
+ #
153
+ # @see Lotus::Routing::RoutesInspector#FORMATTER
154
+ # @see Lotus::Routing::RoutesInspector#to_s
155
+ def inspect_routes(formatter, base_path)
156
+ result = ''
139
157
 
140
158
  # TODO refactoring: replace conditional with polymorphism
141
159
  # We're exposing too much knowledge from Routing::Route:
@@ -148,10 +166,6 @@ module Lotus
148
166
  end
149
167
  end
150
168
 
151
- unless result.include?(INSPECTOR_HEADER_NAME)
152
- result.insert(0, formatter % INSPECTOR_HEADER_HASH + EMPTY_LINE)
153
- end
154
-
155
169
  result
156
170
  end
157
171
 
@@ -194,7 +208,7 @@ module Lotus
194
208
  # @see Lotus::Routing::RoutesInspector#FORMATTER
195
209
  # @see Lotus::Routing::RoutesInspector#to_s
196
210
  def inspect_router(formatter, router, route, base_path)
197
- router.inspector.to_s(formatter, base_path.join(route.path_for_generation))
211
+ router.inspector.inspect_routes(formatter, base_path.join(route.path_for_generation))
198
212
  end
199
213
  end
200
214
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotus-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-01-12 00:00:00.000000000 Z
13
+ date: 2016-01-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http_router