diatheke 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +3 -0
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/diatheke.rb +8 -5
- data/test/test_diatheke.rb +8 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bb793eaf473921eaa0daf081dc2361f86b9af35
|
4
|
+
data.tar.gz: 0220a2355cb328882df3d89ea20ac2595c701187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d969e16e7f8062bf51efa6dc7c0ec0f77e545b80d10b1d6b14d0249ea196c7b63c559ad5906714cbb80f3f77cd9077c276901ba477d1a10c132a79a807e573
|
7
|
+
data.tar.gz: ff34f6dff4074b7868c78f911e71eeac78d9fde96366f60618e251542a9ada92a1a5277b413f99e8e2f1a050084fc38acb866a90cb8e937579558efb0435efef
|
data/Changelog
CHANGED
data/README.md
CHANGED
@@ -19,13 +19,13 @@ This library is a wrapper of the
|
|
19
19
|
puts Diatheke.passage('KJV', 'John 1').to_yaml
|
20
20
|
|
21
21
|
# Search a phrase
|
22
|
-
p Diatheke.search('KJV', 'with God', :
|
22
|
+
p Diatheke.search('KJV', 'with God', range: 'Joh 1')
|
23
23
|
|
24
24
|
# Search with method "multi word"
|
25
|
-
p Diatheke.search('KJV', %w(God Jesus), :
|
25
|
+
p Diatheke.search('KJV', %w(God Jesus), range: 'Joh 1')
|
26
26
|
|
27
27
|
# Search with regular expression
|
28
|
-
p Diatheke.search('KJV', /Jesus.+Jesus/, :
|
28
|
+
p Diatheke.search('KJV', /Jesus.+Jesus/, range: 'Joh 1')
|
29
29
|
|
30
30
|
## Author
|
31
31
|
|
data/Rakefile
CHANGED
data/lib/diatheke.rb
CHANGED
@@ -19,18 +19,18 @@ module Diatheke
|
|
19
19
|
call('system', 'modulelistnames').split(/\n/)
|
20
20
|
end
|
21
21
|
|
22
|
-
def passage(mod, key)
|
23
|
-
s = call(mod, key)
|
22
|
+
def passage(mod, key, **opts)
|
23
|
+
s = call(mod, key, opts)
|
24
24
|
parse_passage s
|
25
25
|
end
|
26
26
|
|
27
|
-
def search(mod, key, opts
|
27
|
+
def search(mod, key, **opts)
|
28
28
|
search_type = :phrase
|
29
29
|
search_key = key
|
30
30
|
case key
|
31
31
|
when Regexp
|
32
32
|
search_type = :regex
|
33
|
-
search_key = key.
|
33
|
+
search_key = key.source
|
34
34
|
when Array
|
35
35
|
search_type = :multiword
|
36
36
|
search_key = key.join(' ')
|
@@ -42,8 +42,11 @@ module Diatheke
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def call(mod, key, opts
|
45
|
+
def call(mod, key, **opts)
|
46
46
|
args = []
|
47
|
+
if f = opts[:format]
|
48
|
+
args << '-f' << f
|
49
|
+
end
|
47
50
|
if s = opts[:search_type]
|
48
51
|
args << '-s' << s
|
49
52
|
end
|
data/test/test_diatheke.rb
CHANGED
@@ -9,24 +9,27 @@ class TestDiatheke < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_passage
|
12
|
-
res = Diatheke.passage('KJV', 'Joh 1:1-3')
|
12
|
+
res = Diatheke.passage('KJV', 'Joh 1:1-3', format: :plain)
|
13
13
|
assert_equal ['John 1:1', 'John 1:2', 'John 1:3'], res.map {|e| e.key}
|
14
14
|
assert_match /^In the beginning was the Word/, res.first.text
|
15
|
+
res = Diatheke.passage('KJV', 'Joh 1:1-3', format: :CGI)
|
16
|
+
assert_equal ['John 1:1', 'John 1:2', 'John 1:3'], res.map {|e| e.key}
|
17
|
+
assert_match %r(^<span >: In the beginning was the Word.+the Word was God.</span><br />$), res.first.text
|
15
18
|
end
|
16
19
|
|
17
20
|
def test_search_phrase
|
18
|
-
res = Diatheke.search('KJV', 'with God', :
|
21
|
+
res = Diatheke.search('KJV', 'with God', range: 'Joh 1')
|
19
22
|
assert_equal ['John 1:1', 'John 1:2'], res
|
20
23
|
end
|
21
24
|
|
22
25
|
def test_search_multiword
|
23
|
-
res = Diatheke.search('KJV', %w(God Jesus), :
|
26
|
+
res = Diatheke.search('KJV', %w(God Jesus), range: 'Joh 1')
|
24
27
|
assert_equal ['John 1:29', 'John 1:36'], res
|
25
28
|
end
|
26
29
|
|
27
30
|
def test_search_regex
|
28
|
-
res = Diatheke.search('KJV', /
|
29
|
-
assert_equal ['John 1:
|
31
|
+
res = Diatheke.search('KJV', /witness.+witness/, range: 'Joh 1')
|
32
|
+
assert_equal ['John 1:7'], res
|
30
33
|
end
|
31
34
|
|
32
35
|
def test_correct_split_with_colon_in_text
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diatheke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Friedrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rim
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.10'
|
27
27
|
description: ''
|
28
28
|
email: janfri26@gmail.com
|
29
29
|
executables: []
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.6.12
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: This library is a wrapper of the diatheke command-line client of the sword
|