hobby 0.0.3 → 0.0.4

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: 4b0ae0b8efe38c2fa31277c8170148944aef182b
4
- data.tar.gz: ad2dd203359e369d4df8a17836e099f97f00a7e8
3
+ metadata.gz: e94efedb075ca089d085a994e9ecedb030f7abc5
4
+ data.tar.gz: 2310fa22a7721635a2c908c107c09389b0f72f79
5
5
  SHA512:
6
- metadata.gz: 60dc8490104a8edbad0ec129d0fe916984bafecdabc8f234952521d2f39bc067c916d4d3e8c1afa5e4c82a8caeeed7eb73b5f4024593b8acdf73684728088513
7
- data.tar.gz: 646a11c3a09a480b3ab53bcf4c99df141786c4d708e64fe8e975e9cea8eeabbbef60cfe66f777f527b9d6854b1ec4edcea865e318d8299f54c99d4385cdede9a
6
+ metadata.gz: 04f4c02193c556faf6a89460471fbaafcbdc079a41f0c5775e5967963661720985a3229fd3191aca391305cf6722ea5bea1c1b37b91eb27114dc9a56b07b1467
7
+ data.tar.gz: 7fdce123c7f0b9a8c7ebbc1e3135b568ae09c9aa2915ef2011a402e1d2960f27ddcf88faf1d2bbe2735f680926bbb892feb32ac0b9ece61071c61db6ba3e353b
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'hobby'
7
- spec.version = '0.0.3'
7
+ spec.version = '0.0.4'
8
8
  spec.authors = ['Anatoly Chernow']
9
9
  spec.email = ['chertoly@gmail.com']
10
10
  spec.summary = %q{A minimal DSL over rack}
@@ -4,7 +4,7 @@ require 'forwardable'
4
4
  require 'hobby/router'
5
5
 
6
6
  module Hobby
7
- App = Hobby # to stay compatible old code
7
+ App = Hobby # to stay compatible with old code
8
8
  VERBS = %w[DELETE GET HEAD OPTIONS PATCH POST PUT]
9
9
 
10
10
  def self.included app
@@ -37,15 +37,17 @@ module Hobby
37
37
 
38
38
  protected
39
39
  def handle env
40
- route = self.class.router.route_for (@env = env)
40
+ catch :halt do
41
+ route = self.class.router.route_for (@env = env)
41
42
 
42
- if route
43
- response.write instance_exec &route
44
- else
45
- response.status = 404
46
- end
43
+ if route
44
+ response.write instance_exec &route
45
+ else
46
+ response.status = 404
47
+ end
47
48
 
48
- response
49
+ response
50
+ end
49
51
  end
50
52
 
51
53
  private
@@ -149,5 +149,12 @@ describe Hobby::App do
149
149
  assert { last_response.body == 'GET:initial:/route' }
150
150
  end
151
151
  end
152
+
153
+ describe Throw do
154
+ it do
155
+ get '/'
156
+ assert { last_response.status == 400 }
157
+ end
158
+ end
152
159
  end
153
160
  end
@@ -0,0 +1,4 @@
1
+ get do
2
+ response.status = 400
3
+ throw :halt, response
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2016-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -50,6 +50,7 @@ files:
50
50
  - spec/apps/Map.rb
51
51
  - spec/apps/Nested.rb
52
52
  - spec/apps/OneRouteRouter.rb
53
+ - spec/apps/Throw.rb
53
54
  - spec/apps/Use.rb
54
55
  - spec/apps/WithoutPath.rb
55
56
  - spec/helper.rb
@@ -87,6 +88,7 @@ test_files:
87
88
  - spec/apps/Map.rb
88
89
  - spec/apps/Nested.rb
89
90
  - spec/apps/OneRouteRouter.rb
91
+ - spec/apps/Throw.rb
90
92
  - spec/apps/Use.rb
91
93
  - spec/apps/WithoutPath.rb
92
94
  - spec/helper.rb