kj_reading 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1dddaf6ccb1e9be9127fbaabdb4258062a0d8fde
4
- data.tar.gz: f55214a5e36069ca3e8583c87a3b8c640a98cb3a
2
+ SHA256:
3
+ metadata.gz: 8199ce39641557435790b0c361b93178c68d86145b170e0cc07b5b477f7a03ab
4
+ data.tar.gz: 3510893d69e2e61ff44f31ced6908b922ca3b6432a1c6472372df4a0f0b8cba4
5
5
  SHA512:
6
- metadata.gz: 620dfa5f1e2cf91f71cf0c957700ba0f7f3eabd5e8d6fff35cc0761e97f88d972ca5123d6cbf026543aaa4678a42e81a494af77e34da1a5bf775a8ca53a48ba9
7
- data.tar.gz: 6eea3f9256a07c74ae39b23f921e439f9e6b22fe72d054e139e64645b78217d93369645547b131eb8424a7c6404ad04e81b951282fc2efa838c5257df66f58c8
6
+ metadata.gz: 4a90543c78ee3847e0387fc2fe46ae26b518c33ef782c2e09579ca081ef3c34d63cd73c115e6b81ab2be9b9186b24ff906389d9a0b9af21c62f86d4a5c5ec892
7
+ data.tar.gz: 8f31a0aab166c620b28b4799549a67f4aa857e1755ae1b1ebc5066d680f4b24880f2e27987c286b6a14b26af4020e9f723509f8a38fc7094c8c8df35b58bfaa7
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/kj_reading.rb CHANGED
@@ -5,39 +5,50 @@
5
5
  require 'kj'
6
6
 
7
7
 
8
+ class KjReadingErr < Exception
9
+ end
10
+
8
11
  class KjReading
9
12
 
10
13
  def self.text(s)
11
14
 
12
- bible = Kj::Bible.new
13
-
14
15
  s.strip.lines.map do |line|
15
-
16
- r = line.match(/(?<book>\w+)\s+(?<chapter>\d+)[,\:]?\s*(?<verses>.*)/)
17
- verses = r[:verses] =~ /(?:\.\.|,|-)/ ? Range.new(*r[:verses]\
18
- .split(/(?:\.\.|,|-)/).map(&:to_i)).to_a : r[:verses]
19
-
20
- "\n" + bible.books(r[:book])[0].chapter(r[:chapter])\
21
- .verses(verses).join(' ') + "\n" + line + "\n"
16
+
17
+ "\n" + self.verses(s).join(' ') + "\n" + line + "\n"
22
18
 
23
19
  end.join
24
20
 
25
21
  end
26
-
22
+
23
+ def self.verses(s)
24
+
25
+ bible = Kj::Bible.new
26
+
27
+ r = s.match(/(?<book>\w+)\s+(?<chapter>\d+)[,\:]?\s*(?<verses>.*)/)
28
+ verses2 = r[:verses] =~ /(?:\.\.|,|-)/ ? Range.new(*r[:verses]\
29
+ .split(/(?:\.\.|,|-)/).map(&:to_i)).to_a : r[:verses]
30
+
31
+ books = bible.books(r[:book])
32
+ raise KjReadingErr, 'More than 1 book found' if books.length > 1
33
+ books[0].chapter(r[:chapter])\
34
+ .verses(verses2)
35
+
36
+ end
37
+
27
38
  def self.abbrev(s)
28
-
39
+
29
40
  Kj::Bible.new.books(s)[0].abbreviations
30
-
41
+
31
42
  end
32
-
43
+
33
44
  def self.books()
34
-
45
+
35
46
  h = Kj::Bible.new.books.inject({}) do |r,x|
36
47
  r.merge(x.name.downcase => x.abbreviations.split(','))
37
48
  end
38
-
49
+
39
50
  end
40
-
51
+
41
52
  def self.check(s)
42
53
  Kj::Bible.new.books(s)[0].name
43
54
  end
@@ -48,7 +59,7 @@ end
48
59
  if __FILE__ == $0 then
49
60
 
50
61
  # e.g. KjReading.text 'mt 16, 18'
51
- # e.g. KjReading.text '1co 1, 22..29'
62
+ # e.g. KjReading.text '1co 1, 22..29'
52
63
 
53
64
  KjReading.text ARGV.first
54
65
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kj_reading
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,27 +10,33 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CER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nq1YPwIDAQABo4GKMIGHMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
27
+ BBQL4XDDduTcer8jxGad28tvovIygjAmBgNVHREEHzAdgRtnZW1tYXN0ZXJAamFt
28
+ ZXNyb2JlcnRzb24uZXUwJgYDVR0SBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
29
+ c29uLmV1MA0GCSqGSIb3DQEBCwUAA4IBgQDFLH74NkRMCIObvpV1jWgWwB/HyHuy
30
+ Kb4EORZ+2iA+s8IUwznRBh8qcUPaT9z6TKuUACFZannY3WLIewwchXBWZbmsPT9S
31
+ u0ZwQ7sbgD90wsgcGh1cgqdaH1H8hr+2b9IIZh2WLvHC9cDprEW9x+/vr8Cg1XGw
32
+ H3XcMD3Fg9sbstFbNWI1U8xy829G+/OVJPkY1jdiZn1o3yt1FY5wzHcBWs8B9DcA
33
+ ewyMOT5x+9AuienVEXYxiMb1Cn4SK1Kfg9Ts5q6jxNK39mcQt8+2bSlIvIYP1paj
34
+ hKAltr7fCIo4xrs6zX0gVPGllFAnctDKz1Lf5bgqjNNtCsYWBWwuzkisb6OWQ3Ne
35
+ C9j3IESfMHO36kNE02e/My1nKbceZjzoZcj1cEygzzFN0UH1lFSS4nBs8+BxkevC
36
+ CcjsjHgPEExmV6XT9P5gsdAJQnvmZzHT+0658wDr7z4Ol3rJkS/9wxkPYrt6vjsm
37
+ ykLujV1tZjdorop/tBEdNK6U+BG6Ehw1SQU=
32
38
  -----END CERTIFICATE-----
33
- date: 2018-07-22 00:00:00.000000000 Z
39
+ date: 2022-07-14 00:00:00.000000000 Z
34
40
  dependencies:
35
41
  - !ruby/object:Gem::Dependency
36
42
  name: kj
@@ -53,7 +59,7 @@ dependencies:
53
59
  - !ruby/object:Gem::Version
54
60
  version: 0.0.16
55
61
  description:
56
- email: james@jamesrobertson.eu
62
+ email: digital.robertson@gmail.com
57
63
  executables: []
58
64
  extensions: []
59
65
  extra_rdoc_files: []
@@ -78,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
84
  - !ruby/object:Gem::Version
79
85
  version: '0'
80
86
  requirements: []
81
- rubyforge_project:
82
- rubygems_version: 2.6.13
87
+ rubygems_version: 3.3.7
83
88
  signing_key:
84
89
  specification_version: 4
85
90
  summary: 'A wrapper of the Kj gem. Usage: KjReading.text "mt 16, 18"'
metadata.gz.sig CHANGED
Binary file