nut 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78b0510dacf5c5eb7282d4ebf6201376588a6f45
4
- data.tar.gz: 7e7d0affcd44869b64813da5686a0faf63cd506b
3
+ metadata.gz: 0729629973ea40de0756c9d11e78eac76dca956b
4
+ data.tar.gz: 083c29fa714de61ea64b195f27cd73dd9db41cd7
5
5
  SHA512:
6
- metadata.gz: c72f5f2bd8c7d816ad30282e4a7f292017503ea051fddb2106022d52d0d58cdd3d7cc2eb061572b8dae9d09a92e34e74dc70af0d05699d27d6e98baef569b8bc
7
- data.tar.gz: 4779a82ab14e4cb5d5c18cc67b3523e516019d1f3231b4cb1958bd7cf2ec2629f288ea0b8d12159e765761b005bec4c15d8efeaee3e36eba358fee0e27f0b3e4
6
+ metadata.gz: de45a553736a1adee1f1f094dfe766caf2876b5d3ff74ecd7f7bf085074e5f466536043de3bd3d56c737c63d45ebade775f3e219cf1f07a38ac7b7ac8288c42d
7
+ data.tar.gz: d52caa94685ce6a82e988e56872e06ec8da243f1845eb24ddd6f4c7f929aa3e2802b2777c8b5bc99d4848c180365691d8499bb316d28160bebab32a6abd55221
data/lib/nut.rb CHANGED
@@ -14,7 +14,7 @@ require 'nut/handler'
14
14
  require 'nut/service'
15
15
 
16
16
  # Nut Module
17
- # @note Root Module for Nut
17
+ # : Root Module for Nut
18
18
  module Nut
19
19
 
20
20
  # Server Name (as served back in Response Headers)
data/lib/nut/handler.rb CHANGED
@@ -28,21 +28,21 @@ module Nut
28
28
  SUPPORTED_VERSION = 'http/1.1'
29
29
 
30
30
  # On Join
31
- # RxIO Service Interface Callback - Triggered each time a Client connects.
31
+ # : RxIO Service Interface Callback - Triggered each time a Client connects.
32
32
  # @param [Hash] client An RxIO Client Hash
33
33
  def self.on_join client
34
34
  # NoOp
35
35
  end
36
36
 
37
37
  # On Drop
38
- # RxIO Service Interface Callback - Triggered each time a Client disconnects.
38
+ # : RxIO Service Interface Callback - Triggered each time a Client disconnects.
39
39
  # @param [Hash] client An RxIO Client Hash
40
40
  def self.on_drop client
41
41
  # NoOp
42
42
  end
43
43
 
44
44
  # Handle Message
45
- # RxIO Service Interface Callback - Triggered each time a message is received from a Client.
45
+ # : RxIO Service Interface Callback - Triggered each time a message is received from a Client.
46
46
  # @param [Hash] client An RxIO Client Hash
47
47
  # @param [String] msg The message received from the Client
48
48
  def self.handle_msg client, msg
@@ -52,7 +52,7 @@ module Nut
52
52
  end
53
53
 
54
54
  # Sub-Process Input
55
- # RxIO Service Interface Callback - Triggered each time a chunk of data is received from a Client.
55
+ # : RxIO Service Interface Callback - Triggered each time a chunk of data is received from a Client.
56
56
  # Some Content-Length-based Requests may not end with a CRLF - this pulls in any left-over data directly from the RxIO Input Buffer.
57
57
  # @param [Hash] client Client Hash
58
58
  def self.subprocess_input client
@@ -65,7 +65,7 @@ module Nut
65
65
  end
66
66
 
67
67
  # Handle Request Data Line
68
- # Ensures availability of a Client Request Context before passing Assembling & Processing.
68
+ # : Ensures availability of a Client Request Context before passing Assembling & Processing.
69
69
  # @param [Hash] client An RxIO Client Hash
70
70
  # @param [String] msg The message received from the Client (including newline)
71
71
  def self.handle_req_dline client, msg
@@ -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
 
@@ -107,7 +107,7 @@ module Nut
107
107
  end
108
108
 
109
109
  # Assemble & Process Request
110
- # Assembles and processes HTTP Requests from individual data lines.
110
+ # : Assembles and processes HTTP Requests from individual data lines.
111
111
  # @param [Hash] creq Client Request Context
112
112
  # @param [String] msg The message received from the Client (including newline)
113
113
  def self.assemble_process_req creq, msg
@@ -132,7 +132,7 @@ module Nut
132
132
  end
133
133
 
134
134
  # Process Request for Client
135
- # Constructs a complete Request Hash from a Client Request Context and passes it to the Request Handler Module's _handle_req_ method.
135
+ # : Constructs a complete Request Hash from a Client Request Context and passes it to the Request Handler Module's _handle_req_ method.
136
136
  # @param [Hash] client An RxIO Client Hash
137
137
  def self.process_req client
138
138
 
@@ -166,7 +166,7 @@ module Nut
166
166
  end
167
167
 
168
168
  # Serve Response
169
- # Sends out an HTTP Response to the Client.
169
+ # : Sends out an HTTP Response to the Client.
170
170
  # @param [Hash] response Response Hash
171
171
  def self.serve_response client, response
172
172
 
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
 
@@ -88,7 +88,7 @@ module Nut
88
88
  end
89
89
 
90
90
  # Build Request Line
91
- # Parses *msg* as the Request Line unless already set, extracting HTTP Verb, URI & Version.
91
+ # : Parses *msg* as the Request Line unless already set, extracting HTTP Verb, URI & Version.
92
92
  # @param [Hash] creq Client Request Context
93
93
  # @param [String] msg A line of text to be processed
94
94
  def self.build_req_line creq, msg
@@ -108,7 +108,7 @@ module Nut
108
108
  end
109
109
 
110
110
  # Build Header
111
- # Extracts HTTP Headers from Request if available and not already set, returning true on success, false otherwise.
111
+ # : Extracts HTTP Headers from Request if available and not already set, returning true on success, false otherwise.
112
112
  # @param [Hash] creq Client Request Context
113
113
  # @param [String] msg A line of text to be processed
114
114
  def self.build_header creq, msg
@@ -125,7 +125,7 @@ module Nut
125
125
  end
126
126
 
127
127
  # Build Generic Headers
128
- # Constructs a structured Header Hash from an Array of text lines.
128
+ # : Constructs a structured Header Hash from an Array of text lines.
129
129
  # @param [Array] lines A bunch of lines containing header data
130
130
  # @return [Hash] A Hash representation of the Headers
131
131
  def self.build_gen_head lines
@@ -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
@@ -164,7 +164,7 @@ module Nut
164
164
  end
165
165
 
166
166
  # Build Body - Chunked
167
- # Assembles Chunks from *msg* (if Headers are complete) and assembles Request Body from them.
167
+ # : Assembles Chunks from *msg* (if Headers are complete) and assembles Request Body from them.
168
168
  # @param [Hash] creq Client Request Context
169
169
  # @param [String] msg A line of text to be processed
170
170
  def self.build_body_chunked creq, msg
@@ -199,7 +199,7 @@ module Nut
199
199
  end
200
200
 
201
201
  # Build Body - Normal (Content-Length)
202
- # Assembles Request Body from *msg* if Headers are complete, until Content-Length is reached.
202
+ # : Assembles Request Body from *msg* if Headers are complete, until Content-Length is reached.
203
203
  # @param [Hash] creq Client Request Context
204
204
  # @param [String] msg A line of text to be processed
205
205
  def self.build_body_normal 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
 
@@ -236,7 +236,7 @@ module Nut
236
236
  end
237
237
 
238
238
  # Is Content-Length?
239
- # Determines whether request is bound by a content-length header.
239
+ # : Determines whether request is bound by a content-length header.
240
240
  # @param [Hash] creq Client Request Context
241
241
  # @return [Boolean]
242
242
  def self.is_content_len? creq
@@ -244,7 +244,7 @@ module Nut
244
244
  end
245
245
 
246
246
  # Is Chunked?
247
- # Determines whether request is chunked (as per transfer-encoding header).
247
+ # : Determines whether request is chunked (as per transfer-encoding header).
248
248
  # @param [Hash] creq Client Request Context
249
249
  # @return [Boolean]
250
250
  def self.is_chunked? creq
@@ -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
 
@@ -52,7 +52,7 @@ module Nut
52
52
  end
53
53
 
54
54
  # Compile Response
55
- # Sends out an HTTP Response to the Client.
55
+ # : Sends out an HTTP Response to the Client.
56
56
  # @param [Hash] response Response Hash
57
57
  def self.compile_response response
58
58
  "HTTP/1.1 #{response[:code]} #{CODES[response[:code]]}\r\n" +
data/lib/nut/service.rb CHANGED
@@ -23,7 +23,7 @@ module Nut
23
23
  attr_reader :request_handler
24
24
 
25
25
  # Construct
26
- # Builds a *Service* set to listen for incoming connections @ _addr_ on _port_.
26
+ # : Builds a *Service* set to listen for incoming connections @ _addr_ on _port_.
27
27
  # @param [String] addr
28
28
  # @param [Fixnum] port
29
29
  # @param [Module] request_handler
data/lib/nut/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  module Nut
6
6
 
7
7
  # Version
8
- VERSION = '0.1.7'
8
+ VERSION = '0.1.8'
9
9
  end
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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse