hermeneutics 1.8 → 1.9

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
  SHA256:
3
- metadata.gz: ef74159e9784d02b32aebb1b32555dbfb1ea388f4197990c649f326e0ad70e1c
4
- data.tar.gz: aee45f2c54b9169d23253ed556fafaa8b5eaba4d22c7ae0b141047ef6e26f4aa
3
+ metadata.gz: c88fb0c48f5ce9d5130e858d86c155c7b2bb42dbb747b9fb5ed66abfad388ad5
4
+ data.tar.gz: aae1bc88540bb33b77a4f4b6daea02155dac144932965cc8bb60e2da9f084444
5
5
  SHA512:
6
- metadata.gz: db155da6e4b37944baf54a2d33d3b4a457a233c038afe7011fc0653fc56dd6bbe5832a168d1e43fb41a9faf706086b8e409b18c110a1d7935443e89ff3348a2f
7
- data.tar.gz: 99d58cad68a872bcedbd669c72ba022f678062db94935baf78908ecc030b4e1c03af6a743f21ab70a4b6069d5eb2b435cc7a58028082e4b745a2f3158149f994
6
+ metadata.gz: e42c54fb360a488b13031c430611a561415114b420538303edb23264116e7da2c905b8f4bebea560bbebf16341c3a73dd928b82346d2bcf4c5d7f2be80591079
7
+ data.tar.gz: f2af0cc6d5352dcd191d6620f359c7e0f6b94624a8bbd863ef44a4a2aded797105899df102c4f14c8111548d6a76258b9213acddda63d16770dce123869368e1
@@ -110,6 +110,10 @@ module Hermeneutics
110
110
  end
111
111
  end
112
112
 
113
+ def =~ re
114
+ to_s =~ re
115
+ end
116
+
113
117
  def plain
114
118
  @plain ||= mk_plain
115
119
  end
@@ -106,7 +106,7 @@ module Hermeneutics
106
106
  #
107
107
  def check path
108
108
  if File.file? path then
109
- File.open path, :encoding => Encoding::ASCII_8BIT do |f|
109
+ File.open path, encoding: Encoding::ASCII_8BIT do |f|
110
110
  f.size.zero? or f.readline =~ RE_F
111
111
  end
112
112
  end
@@ -171,7 +171,7 @@ module Hermeneutics
171
171
  #
172
172
  def deliver msg
173
173
  pos = nil
174
- LockedFile.open @mailbox, "r+", :encoding => Encoding::ASCII_8BIT do |f|
174
+ LockedFile.open @mailbox, "r+", encoding: Encoding::ASCII_8BIT do |f|
175
175
  f.seek [ f.size - 4, 0].max
176
176
  last = ""
177
177
  f.read.each_line { |l| last = l }
@@ -192,7 +192,7 @@ module Hermeneutics
192
192
  # Iterate through <code>MBox</code>.
193
193
  #
194
194
  def each &block
195
- File.open @mailbox, :encoding => Encoding::ASCII_8BIT do |f|
195
+ File.open @mailbox, encoding: Encoding::ASCII_8BIT do |f|
196
196
  m, e = nil, true
197
197
  s, t = t, f.tell
198
198
  f.each_line { |l|
@@ -290,7 +290,7 @@ module Hermeneutics
290
290
  d = Dir.new p
291
291
  d.each { |f|
292
292
  next if f.starts_with? "."
293
- File.open f, :encoding => Encoding::ASCII_8BIT do |f|
293
+ File.open f, encoding: Encoding::ASCII_8BIT do |f|
294
294
  yield f
295
295
  end
296
296
  }
@@ -102,8 +102,8 @@ module Hermeneutics
102
102
 
103
103
  # Create a +Dictionary+ object from a value and a hash.
104
104
  #
105
- # ds = Dictionary.new :v => 1, :a => "rsa-sha256",
106
- # :c => "relaxed/relaxed", ...
105
+ # ds = Dictionary.new v: 1, a: "rsa-sha256",
106
+ # c: "relaxed/relaxed", ...
107
107
  #
108
108
  def initialize hash = nil
109
109
  case hash
@@ -211,7 +211,7 @@ module Hermeneutics
211
211
  #
212
212
  # === Example
213
213
  #
214
- # content_disposition = Contents.new "form-data", :name => "mycontrol"
214
+ # content_disposition = Contents.new "form-data", name: "mycontrol"
215
215
  #
216
216
  # content_type = Contents.parse "text/html; boundary=0123456"
217
217
  # content_type.caption #=> "text/html"
@@ -242,7 +242,7 @@ module Hermeneutics
242
242
 
243
243
  # Create a +Contents+ object from a value and a hash.
244
244
  #
245
- # c = Contents.new "text/html", :boundary => "0123456"
245
+ # c = Contents.new "text/html", boundary: "0123456"
246
246
  #
247
247
  def initialize caption, hash = nil
248
248
  if caption =~ RES or caption =~ REA then
@@ -280,7 +280,7 @@ module Hermeneutics
280
280
  # E-Mail header field or from a value and a hash.
281
281
  #
282
282
  # c = ContentType.parse "text/html; boundary=0123456"
283
- # c = ContentType.new "text/html", :boundary => "0123456"
283
+ # c = ContentType.new "text/html", boundary: "0123456"
284
284
  #
285
285
  def initialize line, sf = nil
286
286
  line = line.join "/" if Array === line
@@ -29,14 +29,14 @@ module Hermeneutics
29
29
  # space
30
30
  #
31
31
  # body "#dummy" do
32
- # properties :background_color => "f7f7f7".to_rgb
33
- # div ".child", :background_color => "e7e7e7".to_rgb
32
+ # properties background_color: "f7f7f7".to_rgb
33
+ # div ".child", background_color: "e7e7e7".to_rgb
34
34
  # @b = selector
35
35
  # td do
36
36
  # @bt = selector
37
37
  # end
38
38
  # end
39
- # selectors @b, @bt, :fon_size => :large
39
+ # selectors @b, @bt, font_size: :large
40
40
  # end
41
41
  # end
42
42
  # Hermeneutics::Css.document
@@ -116,21 +116,14 @@ module Hermeneutics
116
116
  attr_accessor :keep_8bit
117
117
 
118
118
  # :call-seq:
119
- # new( keep_8bit = nil) -> ent
120
- # new( :keep_8bit => val) -> ent
119
+ # new( keep_8bit: bool) -> ent
121
120
  #
122
121
  # Creates an <code>Entities</code> converter.
123
122
  #
124
- # The parameter may be given as one value or as a hash.
123
+ # ent = Entities.new keep_8bit: true
125
124
  #
126
- # ent = Entities.new true
127
- # ent = Entities.new :keep_8bit => true
128
- #
129
- def initialize keep_8bit = nil
130
- @keep_8bit = case keep_8bit
131
- when Hash then keep_8bit[ :keep_8bit]
132
- else keep_8bit
133
- end
125
+ def initialize keep_8bit: nil
126
+ @keep_8bit = keep_8bit
134
127
  end
135
128
 
136
129
  # :call-seq:
@@ -270,16 +263,14 @@ module Hermeneutics
270
263
  #
271
264
  # The parameters may be given as values or as a hash.
272
265
  #
273
- # utx = URLText.new :keep_8bit => true, :keep_space => false
266
+ # utx = URLText.new keep_8bit: true, keep_space: false
274
267
  #
275
268
  # See the +encode+ method for an explanation of these parameters.
276
269
  #
277
- def initialize hash = nil
278
- if hash then
279
- @keep_8bit = hash[ :keep_8bit ]
280
- @keep_space = hash[ :keep_space]
281
- @mask_space = hash[ :mask_space]
282
- end
270
+ def initialize keep_8bit: nil, keep_space: nil, mask_space: nil
271
+ @keep_8bit = keep_8bit
272
+ @keep_space = keep_space
273
+ @mask_space = mask_space
283
274
  end
284
275
 
285
276
  # :call-seq:
@@ -294,7 +285,7 @@ module Hermeneutics
294
285
  # +keep_8bit+ is set. The result will be in the same encoding as the
295
286
  # argument although this normally has no meaning.
296
287
  #
297
- # utx = URLText.new :keep_8bit => true
288
+ # utx = URLText.new keep_8bit: true
298
289
  # s = "< ä >".encode "UTF-8"
299
290
  # utx.encode s #=> "%3C+\u{e4}+%3E" in UTF-8
300
291
  #
@@ -304,7 +295,7 @@ module Hermeneutics
304
295
  # A space <code>" "</code> will not be replaced by a plus <code>"+"</code>
305
296
  # if +keep_space+ is set.
306
297
  #
307
- # utx = URLText.new :keep_space => true
298
+ # utx = URLText.new keep_space: true
308
299
  # s = "< x >"
309
300
  # utx.encode s #=> "%3C x %3E"
310
301
  #
@@ -382,11 +373,11 @@ module Hermeneutics
382
373
  #
383
374
  # utx = URLText.new
384
375
  #
385
- # h = { :name => "John Doe", :age => 42 }
376
+ # h = { name: "John Doe", age: 42 }
386
377
  # utx.encode_hash h
387
378
  # #=> "name=John+Doe&age=42"
388
379
  #
389
- # h = { :a => ";;;", :x => "äöü" }
380
+ # h = { a: ";;;", x: "äöü" }
390
381
  # utx.encode_hash h
391
382
  # #=> "a=%3B%3B%3B&x=%C3%A4%C3%B6%C3%BC"
392
383
  #
@@ -407,7 +398,7 @@ module Hermeneutics
407
398
  # Make an URL.
408
399
  #
409
400
  # utx = URLText.new
410
- # h = { :name => "John Doe", :age => "42" }
401
+ # h = { name: "John Doe", age: "42" }
411
402
  # utx.encode_hash "myscript.rb", h, "chapter"
412
403
  # #=> "myscript.rb?name=John+Doe&age=42#chapter"
413
404
  #
@@ -543,8 +534,8 @@ module Hermeneutics
543
534
  # == Examples
544
535
  #
545
536
  # con = HeaderExt.new
546
- # con = HeaderExt.new :base64 => true, :limit => 32, :lower => true
547
- # con = HeaderExt.new :mask => /["'()]/
537
+ # con = HeaderExt.new base64: true, limit: 32, lower: true
538
+ # con = HeaderExt.new mask: /["'()]/
548
539
  #
549
540
  def initialize params = nil
550
541
  if params then
@@ -600,7 +591,7 @@ module Hermeneutics
600
591
  # e.encode! "iso8859-15" ; con.encode e #=> "=?ISO8859-15?Q?=A4?="
601
592
  # e.encode! "ms-ansi" ; con.encode e #=> "=?MS-ANSI?Q?=80?="
602
593
  #
603
- # con = HeaderExt.new :mask => /["'()]/
594
+ # con = HeaderExt.new mask: /["'()]/
604
595
  # con.encode "'Stop!' said Fred."
605
596
  # #=> "=?UTF-8?Q?=27Stop=21=27?= said Fred."
606
597
  #
@@ -698,7 +689,7 @@ module Hermeneutics
698
689
  # The standard header content encoding has a word break limit of 64.
699
690
  #
700
691
  def std
701
- @std ||= new :limit => 64
692
+ @std ||= new limit: 64
702
693
  end
703
694
 
704
695
  # :call-seq:
@@ -20,19 +20,19 @@ module Hermeneutics
20
20
  # title { "Example" }
21
21
  # comment "created as an example, #{Time.now}"
22
22
  # }
23
- # body( :bgcolor => Hermeneutics::Color.from_s( "ffffef")) {
23
+ # body bgcolor: Hermeneutics::Color.from_s( "ffffef") do
24
24
  # h1 {
25
25
  # pcdata "Ruby "
26
- # a( :href => "www.w3.org") { "Html" }
26
+ # a href: "www.w3.org" do "Html" end
27
27
  # _ { " example" }
28
28
  # }
29
29
  # p { "Some text.\nBye." }
30
30
  # p {
31
31
  # self << "link"
32
32
  # br
33
- # a( :href => "www.w3.org") { "Html" }
33
+ # a href: "www.w3.org" do "Html" end
34
34
  # }
35
- # }
35
+ # end
36
36
  # }
37
37
  # end
38
38
  # end
@@ -577,7 +577,7 @@ module Hermeneutics
577
577
  c = @headers.field :content_type
578
578
  u = @body.boundary
579
579
  if c[ :boundary] != u then
580
- @headers.replace :content_type, c.fulltype, :boundary => u
580
+ @headers.replace :content_type, c.fulltype, boundary: u
581
581
  end
582
582
  end
583
583
  r << @headers.to_s << $/ << @body.to_s
@@ -14,7 +14,7 @@
14
14
  module Hermeneutics
15
15
 
16
16
  NAME = "hermeneutics"
17
- VERSION = "1.8".freeze
17
+ VERSION = "1.9".freeze
18
18
  SUMMARY = "CGI and mail handling"
19
19
 
20
20
  DESCRIPTION = <<~EOT
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.8'
4
+ version: '1.9'
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-06-16 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: supplement