omah_search 0.1.0 → 0.2.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/omah_search.rb +18 -11
- data.tar.gz.sig +0 -0
- metadata +12 -12
- 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: d4ed5b3c86ecb8eb64122bac7703f0c62ef6cabd
|
|
4
|
+
data.tar.gz: 12aee622b9b37585c8bcf0e9b64cbf90f31ff8c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dad3030c14f6e176febb9af1a5723fde8b13e8a7ac37049eebbfa7df807daaf93a3fd67d8a70ca3ae62b8c6b74cf4b6f3fc9125dfb6297ec64af285dcd267a11
|
|
7
|
+
data.tar.gz: 5a6ca46742eb9b5806a71a91121954efb7b991e415a265af9f091cb3ec82f3a258b28825bf2fa3ff4b6b4a61ca15c8ce8ad1ffabefb65f82612529cfa13c8a58
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/omah_search.rb
CHANGED
|
@@ -2,33 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
# file: omah_search.rb
|
|
4
4
|
|
|
5
|
-
require "sqlite3"
|
|
6
5
|
require 'dynarex'
|
|
6
|
+
require 'recordx_sqlite'
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class OmahSearch
|
|
10
10
|
|
|
11
|
-
def initialize(db_file='headers.db')
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
@
|
|
11
|
+
def initialize(db_file='headers.db', url_base: nil)
|
|
12
|
+
|
|
13
|
+
@rs = RecordxSqlite.new(db_file)
|
|
14
|
+
@url_base = url_base
|
|
15
15
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def search(keyword)
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
@rs.query( "select date, from_x, to_x, subject, filepath from headers " +
|
|
21
21
|
"where from_x like '%#{keyword}%' " +
|
|
22
22
|
"or subject like '%#{keyword}%' order by id desc limit 10" )
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
a = @rs.all.map do |x|
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
date: x.date[/^[^T]+/], from: x.from_x, to: x.to_x, subject: x.subject,
|
|
28
|
+
url: "[link](%s%s)" % [@url_base, x.filepath]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
24
33
|
dx = Dynarex.new
|
|
25
|
-
a = r.to_a.map {|row| row[0].slice!(/T[^T]+$/); row}
|
|
26
|
-
|
|
27
34
|
dx.import a
|
|
28
35
|
table = dx.to_table
|
|
29
|
-
table.labels = %w(date from to subject )
|
|
36
|
+
table.labels = %w(date from to subject link)
|
|
30
37
|
table.markdown = true
|
|
31
38
|
table
|
|
32
39
|
end
|
|
33
40
|
|
|
34
|
-
end
|
|
41
|
+
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omah_search
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,48 +31,48 @@ cert_chain:
|
|
|
31
31
|
z09kLQzLRi8385RDh2u1niQgWzcsGz1kVmKs+NzaFjvUYUY3GA1bP7wGLoMA4MkO
|
|
32
32
|
8HkKDVgvtq+gmg==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2016-07-
|
|
34
|
+
date: 2016-07-17 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
|
-
name:
|
|
37
|
+
name: dynarex
|
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
|
40
40
|
- - "~>"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '1.
|
|
42
|
+
version: '1.7'
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 1.
|
|
45
|
+
version: 1.7.9
|
|
46
46
|
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
|
50
50
|
- - "~>"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '1.
|
|
52
|
+
version: '1.7'
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 1.
|
|
55
|
+
version: 1.7.9
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
|
-
name:
|
|
57
|
+
name: recordx-sqlite
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
60
|
- - "~>"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
62
|
+
version: '0.2'
|
|
63
63
|
- - ">="
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version:
|
|
65
|
+
version: 0.2.0
|
|
66
66
|
type: :runtime
|
|
67
67
|
prerelease: false
|
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements:
|
|
70
70
|
- - "~>"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
72
|
+
version: '0.2'
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: 0.2.0
|
|
76
76
|
description:
|
|
77
77
|
email: james@r0bertson.co.uk
|
|
78
78
|
executables: []
|
metadata.gz.sig
CHANGED
|
Binary file
|