hermeneutics 1.9 → 1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hermeneutics/cgi.rb +6 -6
- data/lib/hermeneutics/contents.rb +1 -1
- data/lib/hermeneutics/css.rb +2 -2
- data/lib/hermeneutics/html.rb +5 -5
- data/lib/hermeneutics/message.rb +6 -7
- data/lib/hermeneutics/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 721abdbe281ba643a27fefdcb8016c0f1a0202ed65e6c9741b5a90c3320c121e
|
4
|
+
data.tar.gz: c78e80af37ced64e8ab89d19b729da96f3b6d0e888f0bf0c5de96274bbdf30c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f6297db18bab61106428eee10338bfe4907dae30fa12bfbff8dc3e94a931b349befc4f5fa65bd21c9b053d9c9e8904d8c7d9920fc2f63f51d393167dc13a0b
|
7
|
+
data.tar.gz: 9f96a1b60536b83254252029fa36fa3e7ed739f270799bd8ccd155e068407a4b31de0073bb7049c5306b7096f5c9b54dca7ba53f8564966f7e82e6830cc644f4
|
data/lib/hermeneutics/cgi.rb
CHANGED
@@ -70,11 +70,11 @@ module Hermeneutics
|
|
70
70
|
document Html
|
71
71
|
end
|
72
72
|
|
73
|
-
def parameters
|
73
|
+
def parameters &block
|
74
74
|
if block_given? then
|
75
75
|
case request_method
|
76
76
|
when "GET", "HEAD" then parse_query query_string, &block
|
77
|
-
when "POST" then parse_posted
|
77
|
+
when "POST" then parse_posted &block
|
78
78
|
else parse_input &block
|
79
79
|
end
|
80
80
|
else
|
@@ -107,8 +107,8 @@ module Hermeneutics
|
|
107
107
|
URLText.decode_hash data, &block
|
108
108
|
end
|
109
109
|
|
110
|
-
def parse_posted
|
111
|
-
data =
|
110
|
+
def parse_posted &block
|
111
|
+
data = $stdin.read.force_encoding Encoding::ASCII_8BIT
|
112
112
|
data.bytesize == content_length.to_i or
|
113
113
|
@warn = "Content length #{content_length} is wrong (#{data.bytesize})."
|
114
114
|
ct = ContentType.parse content_type
|
@@ -116,7 +116,7 @@ module Hermeneutics
|
|
116
116
|
when "application/x-www-form-urlencoded" then
|
117
117
|
parse_query data, &block
|
118
118
|
when "multipart/form-data" then
|
119
|
-
mp = Multipart.parse data, ct.hash
|
119
|
+
mp = Multipart.parse data, **ct.hash
|
120
120
|
parse_multipart mp, &block
|
121
121
|
when "text/plain" then
|
122
122
|
# Suppose this is for testing purposes only.
|
@@ -130,7 +130,7 @@ module Hermeneutics
|
|
130
130
|
mp.each { |part|
|
131
131
|
cd = part.headers.content_disposition
|
132
132
|
if cd.caption == "form-data" then
|
133
|
-
yield cd.name, part.
|
133
|
+
yield cd.name, part.body_decoded, **cd.hash
|
134
134
|
end
|
135
135
|
}
|
136
136
|
end
|
data/lib/hermeneutics/css.rb
CHANGED
@@ -242,8 +242,8 @@ module Hermeneutics
|
|
242
242
|
def single hash
|
243
243
|
if block_given? then
|
244
244
|
hash.map { |k,v|
|
245
|
-
if Symbol === k then k = k.
|
246
|
-
if Array === v then v = v.join " "
|
245
|
+
if Symbol === k then k = k.to_s ; k.gsub! /_/, "-" end
|
246
|
+
if Array === v then v = v.join " " end
|
247
247
|
yield "#{k}: #{v};"
|
248
248
|
}
|
249
249
|
else
|
data/lib/hermeneutics/html.rb
CHANGED
@@ -52,9 +52,9 @@ module Hermeneutics
|
|
52
52
|
yield i
|
53
53
|
end
|
54
54
|
end
|
55
|
-
def document *args, &block
|
55
|
+
def document *args, **kwargs, &block
|
56
56
|
open do |i|
|
57
|
-
i.document *args, &block
|
57
|
+
i.document *args, **kwargs, &block
|
58
58
|
end
|
59
59
|
end
|
60
60
|
def write_file name = nil
|
@@ -81,9 +81,9 @@ module Hermeneutics
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
def document *args, &block
|
84
|
+
def document *args, **kwargs, &block
|
85
85
|
doctype_header
|
86
|
-
build *args, &block
|
86
|
+
build *args, **kwargs, &block
|
87
87
|
end
|
88
88
|
|
89
89
|
def doctype_header
|
@@ -270,7 +270,7 @@ module Hermeneutics
|
|
270
270
|
def mkattrs attrs
|
271
271
|
attrs or return
|
272
272
|
attrs.each { |k,v|
|
273
|
-
if Symbol === k then k = k.
|
273
|
+
if Symbol === k then k = k.to_s ; k.gsub! /_/, "-" end
|
274
274
|
v = case v
|
275
275
|
when Array then v.compact.join " "
|
276
276
|
when true then k.to_s if @assign_attributes
|
data/lib/hermeneutics/message.rb
CHANGED
@@ -65,7 +65,7 @@ module Hermeneutics
|
|
65
65
|
MIME = /^multipart\//
|
66
66
|
|
67
67
|
class IllegalBoundary < StandardError ; end
|
68
|
-
class ParseError
|
68
|
+
class ParseError < StandardError ; end
|
69
69
|
|
70
70
|
# :stopdoc:
|
71
71
|
class PartFile
|
@@ -130,7 +130,7 @@ module Hermeneutics
|
|
130
130
|
|
131
131
|
class <<self
|
132
132
|
|
133
|
-
def parse input, parameters
|
133
|
+
def parse input, **parameters
|
134
134
|
b = parameters[ :boundary]
|
135
135
|
b or raise ParseError, "Missing boundary parameter."
|
136
136
|
PartFile.open input, b do |partfile|
|
@@ -493,7 +493,7 @@ module Hermeneutics
|
|
493
493
|
|
494
494
|
private :new
|
495
495
|
|
496
|
-
def parse input
|
496
|
+
def parse input
|
497
497
|
parse_hb input do |h,b|
|
498
498
|
new h, b
|
499
499
|
end
|
@@ -596,11 +596,10 @@ module Hermeneutics
|
|
596
596
|
when "base64" then
|
597
597
|
(@body.unpack "m").join
|
598
598
|
else
|
599
|
-
@body
|
600
|
-
end
|
601
|
-
if (c = @headers.content_type) and (s = c[ :charset]) then
|
602
|
-
r.force_encoding s
|
599
|
+
@body
|
603
600
|
end
|
601
|
+
c = @headers.content_type
|
602
|
+
r.force_encoding c&&c[ :charset] || Encoding::ASCII_8BIT
|
604
603
|
r
|
605
604
|
end
|
606
605
|
|
data/lib/hermeneutics/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hermeneutics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.10'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: supplement
|