hart 0.0.1 → 0.0.2

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: 0e2f4a971dd9e107927c8c5773c11fe9ddad051f
4
- data.tar.gz: a0c803538d828027597f92fb858e8fd6ec045196
3
+ metadata.gz: e911126ddb2bbab2837ac3eda556f24bf7906ab9
4
+ data.tar.gz: d43d0c1b55e0981756ed34163c81b266ba96ec2e
5
5
  SHA512:
6
- metadata.gz: 5a3edcbd23fc68ef7e909f9519867de831d4d91e9faff7e87f71f393977b107922e350f028c15e100a01a89ec8aaea52ecfcfbe312776c9480a944e7d919a4ac
7
- data.tar.gz: e9b7d0b13c984f6b683893326eccd32b400d71dbbd243ec0c6e388d6630e09f409745f653ab155a1d64a5a661bfff28e29f3ad3fd707e5c1a9eb815a1292f130
6
+ metadata.gz: 3024497777d98362035c852453387c3e063292014bf1f47d6fd76d8d7df6bc760482c9137f7987c3d77c2916d03ef5e4407084207f99c12ee8d9b4c395a78187
7
+ data.tar.gz: 80e8aad29fc8e3970433fa704cd44652bf6eeff192755666d0f0e4a644179b8a33f1811634dd87b06f9941d5392db26b03fa336eea0632c25305cb66ddca46df
data/CHANGELOG CHANGED
@@ -0,0 +1,3 @@
1
+ 0.0.2
2
+
3
+ * Return default when the verb doesn't match (@srabuini)
data/README.md CHANGED
@@ -41,7 +41,7 @@ words = {
41
41
  }
42
42
  }
43
43
 
44
- h = Hart.new(routes)
44
+ h = Hart.new(words)
45
45
  h.call(:define, "/c/o/d") #=> "A husk; a pod; as, a peascod."
46
46
  h.call(:define, "/c/o/d/e") #=> "System of rules relating to one subject."
47
47
  h.call(:define, "/c/o/d/e/r") #=> nil
@@ -133,7 +133,7 @@ routes = {
133
133
  },
134
134
 
135
135
  "users" => {
136
- GET: [200, {}, ["GET /posts"]],
136
+ GET: [200, {}, ["GET /users"]],
137
137
 
138
138
  id: proc { |id|
139
139
  {
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "hart"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
  s.summary = "Hash routing"
5
5
  s.description = "Hash routing"
6
6
  s.authors = ["Michel Martens"]
@@ -41,10 +41,6 @@ class Hart
41
41
  break if route.nil?
42
42
  end
43
43
 
44
- if route
45
- route[verb.intern]
46
- else
47
- routes[:default]
48
- end
44
+ route && route[verb.intern] || routes[:default]
49
45
  end
50
46
  end
@@ -114,6 +114,10 @@ scope "routing HTTP requests" do
114
114
  assert_equal 200, f.last_response.status
115
115
  assert_equal "GET /foo/bar", f.last_response.body
116
116
 
117
+ f.get("/foo")
118
+ assert_equal 404, f.last_response.status
119
+ assert_equal "", f.last_response.body
120
+
117
121
  f.put("/foo/bar")
118
122
  assert_equal 200, f.last_response.status
119
123
  assert_equal "PUT /foo/bar", f.last_response.body
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: seg