http_router 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,14 +18,14 @@ class HttpRouter
18
18
  lookup_ivar = :"@lookup_#{router.next_counter}"
19
19
  inject_root_ivar(lookup_ivar, @map)
20
20
  inject_root_methods @map.keys.map {|k|
21
- method = :"lookup_#{object_id}_#{k.hash}"
21
+ method = :"lookup_#{object_id} #{k}"
22
22
  "define_method(#{method.inspect}) do |request|
23
23
  part = request.path.shift
24
24
  #{@map[k].map{|n| n.to_code} * "\n"}
25
25
  request.path.unshift part
26
26
  end"}.join("\n")
27
27
  code = "
28
- send(\"lookup_#{object_id}_\#{request.path.first.hash}\", request) if !request.path_finished? && #{lookup_ivar}.key?(request.path.first)
28
+ send(\"lookup_#{object_id} \#{request.path.first}\", request) if !request.path_finished? && #{lookup_ivar}.key?(request.path.first)
29
29
  "
30
30
  end
31
31
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  class HttpRouter #:nodoc
3
- VERSION = '0.8.5'
3
+ VERSION = '0.8.6'
4
4
  end
@@ -19,4 +19,11 @@ class TestMisc < MiniTest::Unit::TestCase
19
19
  assert_equal :test, r1.routes.first.dest
20
20
  assert_equal :test, r2.routes.first.dest
21
21
  end
22
+
23
+ def test_reseting
24
+ r = HttpRouter.new { add('/hi').to(:test) }
25
+ assert r.recognize(Rack::MockRequest.env_for('/hi'))
26
+ r.reset!
27
+ assert !r.recognize(Rack::MockRequest.env_for('/hi'))
28
+ end
22
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_router
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 5
10
- version: 0.8.5
9
+ - 6
10
+ version: 0.8.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull
@@ -15,11 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-02 00:00:00 -07:00
18
+ date: 2011-06-07 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ name: rack
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
24
26
  requirements:
25
27
  - - ">="
@@ -30,12 +32,12 @@ dependencies:
30
32
  - 0
31
33
  - 0
32
34
  version: 1.0.0
33
- requirement: *id001
34
- prerelease: false
35
35
  type: :runtime
36
- name: rack
36
+ version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ name: url_mount
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
40
42
  requirements:
41
43
  - - ~>
@@ -46,12 +48,12 @@ dependencies:
46
48
  - 2
47
49
  - 1
48
50
  version: 0.2.1
49
- requirement: *id002
50
- prerelease: false
51
51
  type: :runtime
52
- name: url_mount
52
+ version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ name: minitest
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
55
57
  none: false
56
58
  requirements:
57
59
  - - ~>
@@ -62,12 +64,12 @@ dependencies:
62
64
  - 0
63
65
  - 0
64
66
  version: 2.0.0
65
- requirement: *id003
66
- prerelease: false
67
67
  type: :development
68
- name: minitest
68
+ version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ name: code_stats
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
71
73
  none: false
72
74
  requirements:
73
75
  - - ">="
@@ -76,12 +78,12 @@ dependencies:
76
78
  segments:
77
79
  - 0
78
80
  version: "0"
79
- requirement: *id004
80
- prerelease: false
81
81
  type: :development
82
- name: code_stats
82
+ version_requirements: *id004
83
83
  - !ruby/object:Gem::Dependency
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
84
+ name: rake
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
85
87
  none: false
86
88
  requirements:
87
89
  - - ~>
@@ -92,12 +94,12 @@ dependencies:
92
94
  - 8
93
95
  - 7
94
96
  version: 0.8.7
95
- requirement: *id005
96
- prerelease: false
97
97
  type: :development
98
- name: rake
98
+ version_requirements: *id005
99
99
  - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ name: rbench
101
+ prerelease: false
102
+ requirement: &id006 !ruby/object:Gem::Requirement
101
103
  none: false
102
104
  requirements:
103
105
  - - ">="
@@ -106,12 +108,12 @@ dependencies:
106
108
  segments:
107
109
  - 0
108
110
  version: "0"
109
- requirement: *id006
110
- prerelease: false
111
111
  type: :development
112
- name: rbench
112
+ version_requirements: *id006
113
113
  - !ruby/object:Gem::Dependency
114
- version_requirements: &id007 !ruby/object:Gem::Requirement
114
+ name: phocus
115
+ prerelease: false
116
+ requirement: &id007 !ruby/object:Gem::Requirement
115
117
  none: false
116
118
  requirements:
117
119
  - - ">="
@@ -120,12 +122,12 @@ dependencies:
120
122
  segments:
121
123
  - 0
122
124
  version: "0"
123
- requirement: *id007
124
- prerelease: false
125
125
  type: :development
126
- name: phocus
126
+ version_requirements: *id007
127
127
  - !ruby/object:Gem::Dependency
128
- version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ name: bundler
129
+ prerelease: false
130
+ requirement: &id008 !ruby/object:Gem::Requirement
129
131
  none: false
130
132
  requirements:
131
133
  - - ~>
@@ -136,12 +138,12 @@ dependencies:
136
138
  - 0
137
139
  - 0
138
140
  version: 1.0.0
139
- requirement: *id008
140
- prerelease: false
141
141
  type: :development
142
- name: bundler
142
+ version_requirements: *id008
143
143
  - !ruby/object:Gem::Dependency
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
144
+ name: thin
145
+ prerelease: false
146
+ requirement: &id009 !ruby/object:Gem::Requirement
145
147
  none: false
146
148
  requirements:
147
149
  - - "="
@@ -152,10 +154,8 @@ dependencies:
152
154
  - 2
153
155
  - 8
154
156
  version: 1.2.8
155
- requirement: *id009
156
- prerelease: false
157
157
  type: :development
158
- name: thin
158
+ version_requirements: *id009
159
159
  description: This library allows you to recognize and build URLs in a Rack application.
160
160
  email: joshbuddy@gmail.com
161
161
  executables: []