tansu 0.5.0 → 0.5.5

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: cbf58b1e60bd4e4fccacb3e82574ea4c229e0c49
4
- data.tar.gz: 59e5f0390bdc9c6a621a5e52d0873923628f9399
3
+ metadata.gz: be97fbe1a67fc83dbd196ab45e51873c85d0cebf
4
+ data.tar.gz: dff32f99aa31020c5f1d6fa0447b8413d0d13d99
5
5
  SHA512:
6
- metadata.gz: 74836d1a3c0ccc86a1d5f80732667719c52a0e4ab759bf453d8d3aa40e189220c8932fcf796d703f37ae83f9ca990e70ad234167baf258cc390ddf4a06f42e7e
7
- data.tar.gz: d77bdb7a64c9c816bbcfcb70b9e3f93788049a5201771eb19c2aa8879e6fa1185c3b8af8a60c30c694734e2be0867ff34470ac7f2408ae8092fd5a48e1651c86
6
+ metadata.gz: 8f5178c3b0263617933b808254373707449d29260fdd8f7f95d527f32e61bd2d7dfcc6d642cbc8f23a791ca0377963b73689f13f384dbf4e151493a4a711b220
7
+ data.tar.gz: eb07b6f19f3f53f50ba8692e3ef14a68fc2bb4b12f203ba31ca773d2b31974e09b36bb0b42195042e5b796f2af49f4955862829e83bb22fc814d0acd17f014e9
@@ -18,7 +18,7 @@ module Tansu
18
18
  request = Rack::Request.new(env)
19
19
  environment = Environment.new(request, Response.new)
20
20
 
21
- path = environment.path.empty? ? [:*] : environment.path
21
+ path = (path = environment.params[:path_info]).empty? ? [:*] : path
22
22
  router = path.inject(Tansu.root) { |a, e| a[e] }[request.request_method]
23
23
 
24
24
  if Minicontext::Router::Just === router
@@ -2,12 +2,12 @@ module Tansu
2
2
  class Environment < Minicontext::Environment
3
3
  include Tansu::Render
4
4
 
5
- attr_reader :path
5
+ attr_reader :params
6
6
 
7
7
  IS_RESPOND_TO_EACH = -> (v) { v.respond_to?(:each) }
8
8
 
9
9
  def initialize(request, response = nil)
10
- @path = parse(request.path_info)
10
+ @params = parse(request)
11
11
 
12
12
  super request, response
13
13
  end
@@ -49,10 +49,6 @@ module Tansu
49
49
  request.session
50
50
  end
51
51
 
52
- def params
53
- request.params
54
- end
55
-
56
52
  def logger
57
53
  Application[:logger]
58
54
  end
@@ -63,12 +59,24 @@ module Tansu
63
59
 
64
60
  private
65
61
 
66
- def parse(path)
67
- (path[1..-1] || '').split('/').map(&:to_sym)
68
- end
69
-
70
62
  def redirect?
71
63
  Response === @response && @response.status == 302
72
64
  end
65
+
66
+ def parse(request)
67
+ indifferent_params(request.params).merge(path_info(request.path_info))
68
+ end
69
+
70
+ def indifferent_params(hash)
71
+ indifferent_hash = Hash.new { |h, k| h[k.to_s] if Symbol === k }
72
+
73
+ hash.each_with_object(indifferent_hash) do |(k, v), a|
74
+ a[k] = Hash === v ? indifferent_params(v) : v
75
+ end
76
+ end
77
+
78
+ def path_info(path)
79
+ { 'path_info' => (path[1..-1] || '').split('/').map(&:to_sym) }
80
+ end
73
81
  end
74
82
  end
data/lib/tansu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tansu
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tansu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - daisuko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack