listserv 0.0.1 → 0.0.2
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 +4 -4
- data/lib/listserv.rb +12 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e92b32d9c5eb1a531a6775fe93bb87aaebbf1492
|
4
|
+
data.tar.gz: 923ba68e2de70d24375c2f692f574b93de1aea48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825ed3e42c84abd88cd454999af9e633445c004b9098b45ea0cc862f4cb2af7e6ba5499b2df4df4a307032046fd71f0b1e2ffdd22977da64b971037a875c3e9d
|
7
|
+
data.tar.gz: 64ea14a9e67c0a5c3cfa2460b784c9289e1b55bad49a48ef4f26f1ff8575d8c4e4271552f9540213f0ca5fb6a208b55c8cee8e493d83e58bb4a81cb354b9fd7e
|
data/lib/listserv.rb
CHANGED
@@ -14,15 +14,20 @@ class Listserv
|
|
14
14
|
# Load a file by name
|
15
15
|
def load(filename)
|
16
16
|
@properties = Hash.new
|
17
|
+
|
18
|
+
# After an initial series of 11 characters, Listserv files consist of 100-character "lines"
|
19
|
+
# These lines do not have line terminator characters so we must split them directly based on a 100-character limit.
|
17
20
|
offset = 11
|
18
21
|
length = 100
|
19
22
|
file = filename
|
20
23
|
|
24
|
+
# The first 'line' contains the plain title of the Listserv.
|
21
25
|
@title = IO.read(file, length, offset += length, mode:'rb')
|
22
26
|
@title = @title.strip[2..-1]
|
23
27
|
|
28
|
+
# Read the first section of the file. Settings come in the form of "* Key= Value"
|
24
29
|
while line = IO.read(file, length, offset += length, mode: 'rb')
|
25
|
-
property = line.scan(
|
30
|
+
property = line.scan(/\*\s{1,2}(\S+)= (.+)/)
|
26
31
|
hash = property.to_h
|
27
32
|
hash.each do |k, v|
|
28
33
|
if @properties[k] == nil
|
@@ -37,6 +42,7 @@ class Listserv
|
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
45
|
+
# Read the members, 100-character lines are terminated by the eight-character sequence "//// "
|
40
46
|
@members = Array.new
|
41
47
|
while line = IO.read(file, length, offset += length, mode: 'rb')
|
42
48
|
member_matches = line.scan(/(.{1,80})[\S]{12}\/\/\/\/ /)
|
@@ -66,7 +72,11 @@ class Listserv
|
|
66
72
|
|
67
73
|
# Get the Listserv's password
|
68
74
|
def pw
|
69
|
-
@properties['PW'][0
|
75
|
+
if @properties['PW'].class == Array && @properties['PW'].size > 0
|
76
|
+
@properties['PW'][0]
|
77
|
+
else
|
78
|
+
nil
|
79
|
+
end
|
70
80
|
end
|
71
81
|
|
72
82
|
# Get the Listserv's owners in an array of email addresses
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listserv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin J. Thompson
|
@@ -10,14 +10,15 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: Use this gem to interpret raw files from Listserv, and access the settings
|
14
|
+
and memberships of those listservs.
|
14
15
|
email: ben.thompson@nd.edu
|
15
16
|
executables: []
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
19
20
|
- lib/listserv.rb
|
20
|
-
homepage:
|
21
|
+
homepage: https://github.com/bthompson-nd/ruby-listserv
|
21
22
|
licenses:
|
22
23
|
- MIT
|
23
24
|
metadata: {}
|
@@ -40,5 +41,5 @@ rubyforge_project:
|
|
40
41
|
rubygems_version: 2.4.5.1
|
41
42
|
signing_key:
|
42
43
|
specification_version: 4
|
43
|
-
summary: A gem for parsing Listserv .list files
|
44
|
+
summary: A gem for parsing Listserv's .list files.
|
44
45
|
test_files: []
|