rasti-web 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 764cf867ae8950a2b647667bd7ed1b3a9170abd8
4
- data.tar.gz: 5d96989d2b5e261bc162c2076133016991f6a4e1
3
+ metadata.gz: 10f08a5965047cf50e8e1490f7df2881465db2d6
4
+ data.tar.gz: 7b89630f3be474e823fa3bc0940f2f6ee118b622
5
5
  SHA512:
6
- metadata.gz: 4aa9e4e8a7cfd3453ba4358ad8cd8f5e6c0856886b4f689215fb87c7a374a5b4350ee8c5ce87702e9e22be0d11e45e4fe081200aa0de709a042823ddb0cd51fd
7
- data.tar.gz: 5d867c009e657e111605a24e7dd3d3b9a564e5962d3d890d69c3ef5796d31fbd077bc8d3919babba0230d1c3b3acd6267d8895007de6196458913a188152f6ca
6
+ metadata.gz: b4a4270b678f4f1488ad90ad600add5c56152acd283fe0f551936f23f1952b220a668a4db5c59713b7b228af63b3d9b4c72f3bfeed2c7ba186c949103d349ba5
7
+ data.tar.gz: ce5f7061a3c5ca721ce0accdc8321573e5f75572dafab2c5d8707a68d6e3ecf85852f98ec39e2afd658ee55d29af336de94c65b1bc397010af88b61dbfa300c6
@@ -27,6 +27,10 @@ module Rasti
27
27
  app.call env
28
28
  end
29
29
 
30
+ def all_routes
31
+ router.all_routes
32
+ end
33
+
30
34
  private
31
35
 
32
36
  def router
@@ -8,7 +8,7 @@ module Rasti
8
8
 
9
9
  VERBS.each do |verb|
10
10
  define_method verb do |pattern, endpoint=nil, &block|
11
- routes[verb] << Route.new(pattern, endpoint, &block)
11
+ routes[verb.upcase] << Route.new(pattern, endpoint, &block)
12
12
  end
13
13
  end
14
14
 
@@ -22,6 +22,10 @@ module Rasti
22
22
  route.call env
23
23
  end
24
24
 
25
+ def all_routes
26
+ Hash[routes.map { |m,r| [m, r.map(&:pattern)] }]
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def routes
@@ -29,7 +33,7 @@ module Rasti
29
33
  end
30
34
 
31
35
  def route_for(env)
32
- routes[env['REQUEST_METHOD'].downcase].detect { |r| r.match? env['PATH_INFO'] } || not_found_route
36
+ routes[env['REQUEST_METHOD'].upcase].detect { |r| r.match? env['PATH_INFO'] } || not_found_route
33
37
  end
34
38
 
35
39
  def not_found_route
@@ -1,5 +1,5 @@
1
1
  module Rasti
2
2
  module Web
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
@@ -44,6 +44,10 @@ describe Rasti::Web::Application do
44
44
  TestApp
45
45
  end
46
46
 
47
+ it 'List all routes' do
48
+ app.all_routes.must_equal 'GET' => ['/']
49
+ end
50
+
47
51
  it 'Defined route' do
48
52
  get '/'
49
53
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasti-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.4.3
237
+ rubygems_version: 2.4.8
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Web blocks to build robust applications