nut 0.1.0 → 0.1.1

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: 3af333d81c0b9c200c94d0c6b057bd186160de8e
4
- data.tar.gz: 4cbe18d68cc8ab6027f5be675e7b76ac82f9feea
3
+ metadata.gz: e12581bc9d5611c674258b52a45e5e8f72572e4f
4
+ data.tar.gz: 37567b5bf337ec199be85eb1286e62335142f5aa
5
5
  SHA512:
6
- metadata.gz: 001a4fc589d9566ca0e7b6c9ec07bef69a91b48601f2b48c5be9c7bafd48026de9cfc17d7df22dd63ff5f4368599635a76789ac6968a16dd0e6ffa8ac6bab6a9
7
- data.tar.gz: 9f7cb2a24274a8dc22f6ef41d103edc218f4327e4cfcf698fa82e274c46a012f097e1dc616665ce5d92e210036f8982177c410ea22a2bb44de564ceeb5830f90
6
+ metadata.gz: 51bad58a0bdc8bbf5b64e7ff45419b4918b94ae2bb380a05ce2a053200111874001bd01382fc90c9b20c307e0605e42f230416ba2cd61fd5f1a52dc662eec864
7
+ data.tar.gz: ec78691eb60655637964969ccce8968ae08f25193297292c23212146e8ea20c32bb940c5b64d8d17b07ebbdce1b3749cd8179d794abf445efa73a8a8b99df4ae
data/README.md CHANGED
@@ -5,7 +5,7 @@ Miniature Reactive HTTP Server
5
5
  ## Presentation
6
6
 
7
7
  This library is an implementation of an HTTP Server using the Reactor Pattern as provided by [RxIO](https://rubygems.org/gems/rxio).
8
- This allows easy development of fast, non-blocking Web services.
8
+ This allows easy development of fast, non-blocking web services.
9
9
 
10
10
  ## Installation
11
11
 
@@ -23,11 +23,11 @@ gem install -V nut
23
23
 
24
24
  ### Introduction
25
25
 
26
- *Nut* is a miniature pure-Ruby implementation of a reactive HTTP 1.1 Server.
27
- Relying on [RxIO](https://rubygems.org/gems/rxio), Nut is simple to use yet fast and lightweight.
26
+ Nut is a miniature pure-Ruby implementation of a reactive HTTP Server.
27
+ Relying on [RxIO](https://rubygems.org/gems/rxio), Nut is simple to use, fast and lightweight.
28
28
 
29
29
  ### Request Handler
30
- Nut uses a *request_handler* module to service client requests. This module is to be implemented by the user.
30
+ Nut uses a request_handler module to service client requests. This module is to be implemented by the user.
31
31
  The request_handler module requires only one method: _handle_, which takes two Hashes as arguments: _request_ and _response_.
32
32
 
33
33
  ```ruby
@@ -44,7 +44,7 @@ n = Nut::Service.new ExampleRequestHandler
44
44
 
45
45
  ### The Request Hash
46
46
 
47
- The _request_ argument to the *handle* method is a hash containing information representing a client request.
47
+ The _request_ argument to the *handle* method is a Hash containing information representing a client request.
48
48
 
49
49
  The following fields are available:
50
50
  * *:peer* - RxIO Peer Information Hash such as { name: 'foobar.eresse.net', addr: '51.254.97.136', port: 42432 }
@@ -57,8 +57,8 @@ The following fields are available:
57
57
 
58
58
  ### The Response Hash
59
59
 
60
- The _response_ argument to the *handle* method is a hash that should be filled by the user to represent a response.
61
- The following hash keys are valid:
60
+ The _response_ argument to the *handle* method is a Hash that should be filled by the user to represent a response.
61
+ The following Hash keys are valid:
62
62
 
63
63
  * *:code* - HTTP Response Code (Numeric format) (200, 404, etc...) - If unspecified, defaults to *200* (unless a redirect is requested)
64
64
  * *:body* - Response Body
@@ -179,7 +179,7 @@ end
179
179
 
180
180
  ### Service Interface
181
181
 
182
- The usual _run_ / _stop_ RxIO synchronous service interface is available, as well as the [Runify](https://rubygems.org/gems/runify)-ed version (_startup_ / _shutdown_).
182
+ The usual _run_ / _stop_ RxIO synchronous service interface is available, as well as the [Runify](https://rubygems.org/gems/runify)-ed version ( _startup_ / _shutdown_).
183
183
 
184
184
  #### Running the server
185
185
  ```ruby
data/lib/nut/handler.rb CHANGED
@@ -78,7 +78,7 @@ module Nut
78
78
  end
79
79
 
80
80
  # Ensure Client Request Hash
81
- # Ensures existence of Client Request Hash inside Client Context
81
+ # Ensures existence of Client Request Hash inside Client Context.
82
82
  # @param [Hash] client An RxIO Client Hash
83
83
  def self.ensure_creq client
84
84
 
data/lib/nut/request.rb CHANGED
@@ -17,7 +17,7 @@ module Nut
17
17
  MULTIPART_FIELD_REX = /^([^=]+)=(.+)$/
18
18
 
19
19
  # Pull Request Details
20
- # Extracts any possible Form Data and extended Request details from a Request Hash
20
+ # Extracts any possible Form Data and extended Request details from a Request Hash.
21
21
  # @param [Hash] req Request Hash
22
22
  def self.extract_req_data req
23
23
 
@@ -35,7 +35,7 @@ module Nut
35
35
  end
36
36
 
37
37
  # Extract Multipart Form Data
38
- # Extracts Multipart Form Data from the Request Body and merges it into _req[:params]_
38
+ # Extracts Multipart Form Data from the Request Body and merges it into _req[:params]_.
39
39
  # @param [Hash] req Request Hash
40
40
  def self.extract_multipart_form_data req
41
41
 
@@ -76,7 +76,7 @@ module Nut
76
76
  end
77
77
 
78
78
  # Extract URL-Encoded Form Data
79
- # Extracts URL-Encoded Form Data from the Request Body and merges it into _req[:params]_
79
+ # Extracts URL-Encoded Form Data from the Request Body and merges it into _req[:params]_.
80
80
  # @param [Hash] req Request Hash
81
81
  def self.extract_urlencoded_form_data req
82
82
 
@@ -145,7 +145,7 @@ module Nut
145
145
  end
146
146
 
147
147
  # Build Request Body
148
- # Builds Request Body according to Request Headers (Content-Length / Transfer-Encoding)
148
+ # Builds Request Body according to Request Headers (Content-Length / Transfer-Encoding).
149
149
  # @param [Hash] creq Client Request Context
150
150
  # @param [String] msg A line of text to be processed
151
151
  def self.build_req_body creq, msg
@@ -224,7 +224,7 @@ module Nut
224
224
  end
225
225
 
226
226
  # Build without Body
227
- # Marks Request Body as Complete if no Body should be present (no content-length & no chunked encoding)
227
+ # Marks Request Body as Complete if no Body should be present (no content-length & no chunked encoding).
228
228
  # @param [Hash] creq Client Request Context
229
229
  def self.build_no_body creq
230
230
 
@@ -252,7 +252,7 @@ module Nut
252
252
  end
253
253
 
254
254
  # Expects Body?
255
- # Determines whether request expects a body (according to headers)
255
+ # Determines whether request expects a body (according to headers).
256
256
  # @param [Hash] creq Client Request Context
257
257
  # @return [Boolean]
258
258
  def self.expects_body? creq
data/lib/nut/response.rb CHANGED
@@ -19,7 +19,7 @@ module Nut
19
19
  module Response
20
20
 
21
21
  # Build Response
22
- # Constructs a complete Response from a preliminary Response Hash (code, body)
22
+ # Constructs a complete Response from a preliminary Response Hash (code, body).
23
23
  # @param [Hash] response Preliminary Response Information
24
24
  def self.build_response response
25
25
 
data/lib/nut/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  module Nut
6
6
 
7
7
  # Version
8
- VERSION = '0.1.0'
8
+ VERSION = '0.1.1'
9
9
  end
data/lib/nut.rb CHANGED
@@ -14,7 +14,7 @@ require 'nut/handler'
14
14
  require 'nut/service'
15
15
 
16
16
  # Nut Module
17
- # Root Module for Nut
17
+ # @note Root Module for Nut
18
18
  module Nut
19
19
 
20
20
  # Server Name (as served back in Response Headers)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse