pxindex 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/pxindex.rb +37 -2
- metadata +21 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa3e5764464ae67bc1b996f5e0ff3a4ddbd3b3d
|
4
|
+
data.tar.gz: 707ac50a50cc25440756584b4f4545d770aefce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ed1a8d641e7e16a92acb43eed49fae7ecbdb3cf7504c0386f03c6623d6ba2124e72ed3229535b8e7e66ae5855a28a9c079d415c370e728b61e710e5819b5643
|
7
|
+
data.tar.gz: 47c4b3e7dd048dd292fc3c6b459da025501dfe270616195221000da104f4577e7460d4b7d570993a6b214dfcaa622fc01b599da34c6e1d32a433f37c8d78bd7f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/pxindex.rb
CHANGED
@@ -10,8 +10,20 @@ class PxIndex
|
|
10
10
|
def initialize(raw_s, debug: false)
|
11
11
|
|
12
12
|
s, _ = RXFHelper.read raw_s
|
13
|
+
|
14
|
+
lines = s.lines
|
15
|
+
|
16
|
+
header = []
|
17
|
+
header << lines.shift until lines[0].strip.empty?
|
18
|
+
|
19
|
+
a = LineTree.new(lines.join.gsub(/^# [a-z]\n/,'')).to_a
|
20
|
+
a2 = a.group_by {|x| x.first[0] }.to_a
|
21
|
+
|
22
|
+
s2 = a2.map {|x| '# ' + x[0] + "\n\n" + treeize(x[-1]) }.join("\n\n")
|
23
|
+
|
24
|
+
@raw_px = header.join + "\n" + s2
|
13
25
|
|
14
|
-
@px = PolyrexHeadings.new(
|
26
|
+
@px = PolyrexHeadings.new(@raw_px).to_polyrex
|
15
27
|
@rs = @px.records
|
16
28
|
|
17
29
|
@s = ''
|
@@ -61,6 +73,9 @@ class PxIndex
|
|
61
73
|
|
62
74
|
alias query q?
|
63
75
|
|
76
|
+
def to_s()
|
77
|
+
@raw_px
|
78
|
+
end
|
64
79
|
|
65
80
|
private
|
66
81
|
|
@@ -86,6 +101,13 @@ class PxIndex
|
|
86
101
|
|
87
102
|
a = rs.select {|x| x.title[0..s.length-1] == s}
|
88
103
|
|
104
|
+
if @debug then
|
105
|
+
puts 'a: ' + a.inspect
|
106
|
+
if a.any? then
|
107
|
+
puts 'a.map ' + a.map(&:title).inspect
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
89
111
|
if s.length == 1 and a.any? and keywords.length < 2 then
|
90
112
|
a = a.first.records
|
91
113
|
end
|
@@ -114,5 +136,18 @@ class PxIndex
|
|
114
136
|
end
|
115
137
|
|
116
138
|
end
|
139
|
+
|
140
|
+
def treeize(obj, indent=-2)
|
141
|
+
|
142
|
+
if obj.is_a? Array then
|
143
|
+
|
144
|
+
obj.map {|x| treeize(x, indent+1)}.join("\n")
|
145
|
+
|
146
|
+
else
|
147
|
+
|
148
|
+
' ' * indent + obj
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
117
152
|
|
118
|
-
end
|
153
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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dzdH0LdR0Ta4n6lCEo1nZ+v2RtKhKGZ+F8z7fI8v
|
27
|
+
fp9AGztXcKpguspH/WkOxfFOxQG91gMBNDV/5Zhl/2/JMM2lSt64iz12qZPqvDWa
|
28
|
+
n7Yk5vUX3gcZnfRl34Q5g+irPcjvBRMvYtcGdGR9S5rFoRBIwL11Air5U3W1A59m
|
29
|
+
WtDnRyUCYAhLf/9oAoeeFNFp1H13yw2yiO+upixRUEt6pqQFl3++eDh82JS/2nqL
|
30
|
+
IIkRAfg3vUhmtNQu26Gsi9aZcJAGPKIjdRuYc9oyiGpJv0cQ02HBGRUXnoKS7XYT
|
31
|
+
QDc=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
33
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: polyrex-headings
|
metadata.gz.sig
CHANGED
Binary file
|