nut 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -9
  3. data/lib/nut/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebda47f3a69301778834b5c8e766a37dabc9169b
4
- data.tar.gz: 9615ec759faeca823ec876d81cd554dce13c814a
3
+ metadata.gz: c7419defdf03e8850350d4cf2f8f5accb6c823ea
4
+ data.tar.gz: d4b643813148542fa25319092cd89954e7425b84
5
5
  SHA512:
6
- metadata.gz: 2249a7f8e86972739db63f83ccc6eb514600c50c1d0b97f66c805ae5d239ce0be01da4a0dbf2b29cd7584690a37ac658abfca7b9a95a1394a40bf638146a38b1
7
- data.tar.gz: 690d40fa619e729022234c8e4a9783023d67cf02cef8035748c37f2679f848a7a098a741fc294019af2c08c4ff4f70a3530f175e98439805c8ad5e98dc6f66f7
6
+ metadata.gz: e334ae9088c2fb606326ae0cdd4073831a5c488ffdccf4eef8c1205fd9569c07e179336ad9fe37a1b2ce08442a3b735152f76aef4247df907482b90de0713df1
7
+ data.tar.gz: 6665e5410b25ed63922ea6d2856bee44a2b662a34b194be086d4562419821eea9ce7df59ab7745c30487f1e335d9c4b692fe63521b817f7f49fa5dc339d46879
data/README.md CHANGED
@@ -56,7 +56,7 @@ The request_handler module requires only one method: _handle_, which takes two H
56
56
  ```ruby
57
57
  # Request Handler Module
58
58
  module ExampleRequestHandler
59
- def handle request, response
59
+ def self.handle request, response
60
60
  # All processing done here...
61
61
  end
62
62
  end
@@ -95,7 +95,7 @@ Rendering any output is achieved by appending data to *response[:body]*, as show
95
95
  ```ruby
96
96
  # Request Handler Module
97
97
  module ExampleRequestHandler
98
- def handle request, response
98
+ def self.handle request, response
99
99
 
100
100
  # Spit out some HTML
101
101
  response[:body] << "<html><body>Hello world!</body></html>"
@@ -114,7 +114,7 @@ If *response[:type]* is a String, it will be used directly as the Content-Type.
114
114
  ```ruby
115
115
  # Request Handler Module
116
116
  module ExampleRequestHandler
117
- def handle request, response
117
+ def self.handle request, response
118
118
 
119
119
  # Respond with JSON
120
120
  response[:body] = { success: true, foo: :bar }.to_json
@@ -135,7 +135,7 @@ The available shortcuts are:
135
135
  ```ruby
136
136
  # Request Handler Module
137
137
  module ExampleRequestHandler
138
- def handle request, response
138
+ def self.handle request, response
139
139
 
140
140
  # Respond with JSON
141
141
  response[:body] = { success: true, foo: :bar }.to_json
@@ -155,7 +155,7 @@ If *response[:redirect]* is a String, Nut will respond with a *302 Found* "tempo
155
155
  ```ruby
156
156
  # Request Handler Module
157
157
  module ExampleRequestHandler
158
- def handle request, response
158
+ def self.handle request, response
159
159
 
160
160
  # Temporarily Redirect to 'http://www.example.com'
161
161
  response[:redirect] = 'http://www.example.com'
@@ -171,7 +171,7 @@ If *response[:redirect]* is a Hash, Nut will respond with either a *302 Found* o
171
171
  ```ruby
172
172
  # Request Handler Module
173
173
  module ExampleRequestHandler
174
- def handle request, response
174
+ def self.handle request, response
175
175
 
176
176
  # Permanently Redirect to 'http://www.eresse.net'
177
177
  response[:redirect] = { to: 'http://www.eresse.net', permanent: true }
@@ -191,11 +191,11 @@ To overload the behaviour, simply define an *on_err* method in the Request Handl
191
191
  ```ruby
192
192
  # Request Handler Module
193
193
  module ExampleRequestHandler
194
- def handle request, response
194
+ def self.handle request, response
195
195
  # ...
196
196
  end
197
197
 
198
- def on_err exception, request, response
198
+ def self.on_err exception, request, response
199
199
  response[:code] = 500
200
200
  response[:body] = "Something went wrong: #{exception}"
201
201
  end
@@ -213,7 +213,7 @@ class ExampleService < Nut::Service
213
213
  end
214
214
 
215
215
  module RequestHandler
216
- def handle request, response
216
+ def self.handle request, response
217
217
  response[:body] << "You requested [#{request[:uri]}] as [#{request[:verb]}]"
218
218
  end
219
219
  end
data/lib/nut/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  module Nut
6
6
 
7
7
  # Version
8
- VERSION = '1.2.2'
8
+ VERSION = '1.2.3'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nut
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.6.10
152
+ rubygems_version: 2.5.1
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Miniature Reactive HTTP Server