lotus-router 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/lotus/router/version.rb +1 -1
- data/lib/lotus/routing/routes_inspector.rb +20 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd44d51062b33daa31392d80c9716b54046dc6e
|
4
|
+
data.tar.gz: 2bc1433d02365b6a3d2c2261eb07c2d06a278d4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 632672c9d814633ffeb835a9e2e936dd3087a3a4b1c5f178e68ec364ea32c5ac8617c5b67cd830aa5a6ad535c1e0e3e97e170f2024e3f9309f0a9522bef96aa3
|
7
|
+
data.tar.gz: 3322995dd718005424de21ac6c11ac3b0cc24b9d5b532adf11243a7b0ba5f1896984288737641fa783273ed5498f9e3c4ad1798b7be60be32f66a0f63d51c818
|
data/CHANGELOG.md
CHANGED
@@ -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`
|
data/lib/lotus/router/version.rb
CHANGED
@@ -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
|
-
|
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.
|
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.
|
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-
|
13
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http_router
|