spine-routing 0.2.0 → 0.3.0

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: 55bafb8fe57baaf3d499c9c416693680ec738af1
4
- data.tar.gz: c0ea9a169de6630a47f48760df23f427c7d0d800
3
+ metadata.gz: 4becea9a7a3f05d9ce9bb4e701ef75f5619b0d26
4
+ data.tar.gz: 0a97bd8d1c089ffff56be59b8b2d15d059b54b73
5
5
  SHA512:
6
- metadata.gz: 18ec32f8f0c9e5c78c40726f4cd84cefa2eadc7bd88b889ed73be94de850ee257faae50534df357ae63e75a0ac5791c9a2c62afe182b793d6e4a717d5106e7ee
7
- data.tar.gz: b1a9d6f595967e07d3d3eb973f554e786d669c83c71dfd0a69eab3b162ae6c34c0b1096ce324dc182e3755f2b463c07174a3bba69b1a4bae88972a68b154c924
6
+ metadata.gz: f093bec4d1ba84766c98451cfb92b34aee7a1e488ff3ab01f73cb17c265bf1f89e8e830e14751e442702ed001401b8794015910635f03b4680b0f3408c1d072f
7
+ data.tar.gz: 6fa34127dc338c4026b071e2d9335da0172935712162caff35efb521be9ee38c4189c870946200958a15f6a126992fe4f889b125d62d768049b7e55ce66a7dcf
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 0.3.0
5
+ -----
6
+ - Merges all parameters to Rack environment
7
+
4
8
  0.2.0
5
9
  -----
6
10
  - Adds Spine::Engines extension
data/README.md CHANGED
@@ -34,3 +34,6 @@ end
34
34
 
35
35
  router.call(env)
36
36
  ```
37
+
38
+ For getting parameters use `env['router.parameters']` or include
39
+ `Spine::Routing::Parameters` to your controller/action.
data/lib/spine/routing.rb CHANGED
@@ -10,6 +10,7 @@ module Spine
10
10
  autoload :Namespacing, 'spine/routing/syntax/namespacing'
11
11
  end
12
12
 
13
+ autoload :Parameters, 'spine/routing/parameters'
13
14
  autoload :Engine, 'spine/routing/engine'
14
15
  end
15
16
  end
@@ -0,0 +1,9 @@
1
+ module Spine
2
+ module Routing
3
+ module Parameters
4
+ def params
5
+ env[Router::PARAMETERS]
6
+ end
7
+ end
8
+ end
9
+ end
@@ -22,7 +22,7 @@ module Spine
22
22
  matches = path.match(regex)
23
23
  return nil unless matches
24
24
 
25
- Match.new(self, Hash[matches.names.map(&:to_sym).zip(matches.captures)])
25
+ Match.new(self, Hash[matches.names.zip(matches.captures)])
26
26
  end
27
27
 
28
28
  private
@@ -7,7 +7,7 @@ module Spine
7
7
 
8
8
  VERB = 'REQUEST_METHOD'.freeze
9
9
  PATH = 'PATH_INFO'.freeze
10
- PATH_PARAMETERS = 'router.parameters'.freeze
10
+ PARAMETERS = 'router.parameters'.freeze
11
11
  NOT_FOUND_RESPONSE = [404, {}, ['']].freeze
12
12
 
13
13
 
@@ -44,7 +44,8 @@ module Spine
44
44
  verb = env[VERB].downcase.gsub('head', 'get').to_sym
45
45
  route = recognise(verb, env[PATH])
46
46
  if route
47
- env[PATH_PARAMETERS] = route.parameters
47
+ env[PARAMETERS] = Rack::Request.new(env).params
48
+ env[PARAMETERS].merge!(route.parameters)
48
49
  run(route.app, env)
49
50
  else
50
51
  NOT_FOUND_RESPONSE # TODO: set default app
@@ -1,5 +1,5 @@
1
1
  module Spine
2
2
  module Routing
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spine-routing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TOGGL LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -100,6 +100,7 @@ files:
100
100
  - lib/spine/routing/engine/configuration.rb
101
101
  - lib/spine/routing/engine/loader.rb
102
102
  - lib/spine/routing/nested_router.rb
103
+ - lib/spine/routing/parameters.rb
103
104
  - lib/spine/routing/route.rb
104
105
  - lib/spine/routing/router.rb
105
106
  - lib/spine/routing/syntax/match.rb