hobby 0.0.7 → 0.0.8

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: c943dce2451a4154082cfe2d8fc823273b28c627
4
- data.tar.gz: 78ab9a63570bea6044c18307c8bb2cb7b355b935
3
+ metadata.gz: 9a09d8721fee0c8b802dfc4137a45d746024a10d
4
+ data.tar.gz: b5eebe2c4534c37f43bfde807e243606747bb9b5
5
5
  SHA512:
6
- metadata.gz: 12fc9f283cd851d77de6132caa8ac74401854547b2f0f2639726857327dcf01da99fc8a7e962c924a0f1a644645576c94f51544e596eac98bf280f0a6ce11f9c
7
- data.tar.gz: 3bb0e84f2b8195a51dbbe61bb37d7caea77cfda4dcf02ccea9812a7c037d0ce2d43ee13bf0e4fc12638cb3e5512f8aa24a0ac330460907da70878107b8ddc339
6
+ metadata.gz: f985469d665eb47e06ed8fdfcfb248c08365987b07a010570cef81c2bdad00711012fa99171bccc9218482e5728215dc6146c4ea263583895282d8d13ef35826
7
+ data.tar.gz: 6344ca6071eb2e297b42b3171902abeb34cb3f7ecb4d148499849ab87d0ee15cca2cf9c5dfdf248e9a91365324e7620e71129cc7a1be9b675895f44bf14822cc
data/hobby.gemspec CHANGED
@@ -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.7'
7
+ spec.version = '0.0.8'
8
8
  spec.authors = ['Anatoly Chernow']
9
9
  spec.email = ['chertoly@gmail.com']
10
10
  spec.summary = %q{A minimal DSL over rack}
data/lib/hobby.rb CHANGED
@@ -40,11 +40,8 @@ module Hobby
40
40
  catch :halt do
41
41
  route = self.class.router.route_for (@env = env)
42
42
 
43
- if route
44
- response.write instance_exec &route
45
- else
46
- response.status = 404
47
- end
43
+ body = route ? (instance_exec &route) : not_found
44
+ response.write body
48
45
 
49
46
  response
50
47
  end
@@ -68,4 +65,8 @@ module Hobby
68
65
  def halt
69
66
  throw :halt, response
70
67
  end
68
+
69
+ def not_found
70
+ response.status = 404
71
+ end
71
72
  end
data/readme.adoc CHANGED
@@ -123,17 +123,6 @@ Or, if you are using Rails, you can mount it in `config/routes.rb` with:
123
123
  mount C.new('Hobby') => '/some_path'
124
124
  ----
125
125
 
126
- [[features]]
127
- Features
128
- ~~~~~~~~
129
-
130
- * DSL inspired by http://www.sinatrarb.com/[Sinatra].
131
- * https://github.com/luislavena/bench-micro[Speed].
132
- * Extensible with standard ruby classes and modules, with no extra
133
- logic. See https://github.com/ch1c0t/hobby-auth[hobby-auth] and
134
- https://github.com/ch1c0t/hobby-json[hobby-json].
135
- * Zero configuration.
136
-
137
126
  [[routes]]
138
127
  == Routes
139
128
 
data/spec/app_spec.rb CHANGED
@@ -62,7 +62,6 @@ describe Hobby::App do
62
62
  get '/nonexistent/route'
63
63
 
64
64
  assert { last_response.not_found? }
65
- assert { last_response.body.empty? }
66
65
  end
67
66
  end
68
67
 
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-29 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack