dxtitle_search 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/lib/dxtitle_search.rb +70 -0
- data.tar.gz.sig +2 -0
- metadata +70 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9476fd78ead770df5a8a9e37716acb6feb8fcfc8a2c0ff85809d29006913fe44
|
4
|
+
data.tar.gz: 067f50c3ba518f2a176e7058d889c7899da329a6b48d34f1dfc8c11c6f2c43dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4958c8d393e8e6f64ac9039b79664fd8785cb1e2a9117fb3c2f5454efacc33d1d9fdca2290fa01bb2cc4580e0c22ca8613e3ad4d67936f99f919746bb80c982
|
7
|
+
data.tar.gz: f77b006044b1c3ef601aa5839888f74e1382b7b3f22588b79aeb6af09f8b002ffca392fe1a5ddeb30833568b90eba8af2d2eb41329c96fa239ef5d17a344cb6d
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: dxtitle_search.rb
|
4
|
+
|
5
|
+
require 'dynarex'
|
6
|
+
|
7
|
+
|
8
|
+
class DxTitleSearch
|
9
|
+
|
10
|
+
def initialize(obj, debug: false)
|
11
|
+
|
12
|
+
@debug = debug
|
13
|
+
|
14
|
+
# is it a Dynarex file location?
|
15
|
+
s = if obj.lines.length < 2 then
|
16
|
+
|
17
|
+
xml = RXFHelper.read(obj).first
|
18
|
+
|
19
|
+
dx = Dynarex.new(xml)
|
20
|
+
|
21
|
+
dx.all.map do |x|
|
22
|
+
"%d %s %s" % [Time.parse(x.created).to_i, x.title, x.url]
|
23
|
+
end.join("\n")
|
24
|
+
|
25
|
+
else
|
26
|
+
obj
|
27
|
+
end
|
28
|
+
|
29
|
+
@h = h = s.lines.inject({}) do |r,x|
|
30
|
+
key, value = x.split(/\s+(?=[^\s]+$)/,2)
|
31
|
+
r.merge(key.rstrip => value)
|
32
|
+
end
|
33
|
+
|
34
|
+
@a = h.keys
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def search(keywords)
|
39
|
+
|
40
|
+
# find out the keywords count for each entry found
|
41
|
+
a = keywords.split.flat_map {|x| @a.grep /#{x}/i }.uniq.map do |entry|
|
42
|
+
[entry, entry.scan(/#{keywords.split.join('|')}/).uniq.count]
|
43
|
+
end
|
44
|
+
|
45
|
+
# sort by keywords found per entry and then date
|
46
|
+
a2 = a.sort do |x, x2|
|
47
|
+
-([x.last, x.first[/^\d+/], ] <=> [x2.last, x2.first[/^\d+/]])
|
48
|
+
end
|
49
|
+
|
50
|
+
# format each result as a Hash object
|
51
|
+
a3 = a2.map do |x|
|
52
|
+
|
53
|
+
line, _ = x
|
54
|
+
puts 'line: ' + line.inspect if @debug
|
55
|
+
|
56
|
+
rawtime, title = line.split(/ +/,2)
|
57
|
+
puts 'title: ' + title.inspect if @debug
|
58
|
+
|
59
|
+
{title: title, url: @h[line], date: Time.at(rawtime.to_i)}
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
puts 'a3: ' + a3.inspect if @debug
|
64
|
+
|
65
|
+
return a3
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dxtitle_search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+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utwDz0w0ojYuc48LOVrmGpZ8uH
|
29
|
+
fi2wJx5Jt41/qxGWCz0qo/BFfFZjNllblywzhjIw80HnoGAR5bDaKF0fTdYsh++a
|
30
|
+
Vyx6BkFVM5hYXIJklBT/PLR7JW/rOrFgPNrXM+BlWlFBGIQT8KaF7SfOYrDdqHG8
|
31
|
+
uLlGPgLkR0U3tLfyWwF6548QRVz2Lm53dWeT0JGs974Dj+n1b8P3N0Uv1AFpetNB
|
32
|
+
UTelmW2QjiLgxJxkFkRjp/Ep0s/puw3FbtaviQDBBRr9I/bMAE5QOtKa3k1e7m70
|
33
|
+
39utqhm1XpZeJamPbeuSFl6M3RRiwWACVlz9QjWVgA5JSf1GwCsc0nsa76pq7Yfj
|
34
|
+
DtQaJilztwDXwMGWAJ5qDOiGcuv3Wmec+Nnr/9xoZRA9V/9GqXlWjqSSLgFHk/r1
|
35
|
+
ODgOmcgAsTin0T9l0vWQJnj2OClh1pcC6tFnQXXcYuwTpbtM2v4OmUfUDvJmwQ42
|
36
|
+
POydZUYZg49X9TlTDqPMKed0
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
39
|
+
dependencies: []
|
40
|
+
description:
|
41
|
+
email: james@jamesrobertson.eu
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- lib/dxtitle_search.rb
|
47
|
+
homepage: https://github.com/jrobertson/dxtitle_search
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: dxtitle_search
|
70
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
`��ʛ�����U�;�}2U� F߈P[�P���I��/�1��5M�N�~����?h���Tl�nrq��!�cA�`[a��a��q�w=f���3�KJ;�I�Q�#X���:��]�����)��% ղ'�U(��L��}F�h���N������,խ.��d�>:���4%ZX���ܳ�Y9��>�������g@T,�f� f�����L�����T�8�T�F��qp��^|�I�b��+�X���TA�Y6n���m&I��$��]�yo���vf!�4<�'Io�yMψ̂�Ւ��#��$ �6D�x��O朧*�,�frw�
|