kj_reading 0.1.0 → 0.2.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
2
  SHA1:
3
- metadata.gz: 21a14ae1e70376ca1cddb99f3bc48d82e1abce33
4
- data.tar.gz: 8c69bc09f9e2b447b9c57e0f30d40d41f45fdb4b
3
+ metadata.gz: 1dddaf6ccb1e9be9127fbaabdb4258062a0d8fde
4
+ data.tar.gz: f55214a5e36069ca3e8583c87a3b8c640a98cb3a
5
5
  SHA512:
6
- metadata.gz: 79b811a5356ba694592c141383e4faa527e78759d6d4bdb1b693fcf30530a7b6f2f3aaf51522c0c6fd428fc824e104a8d0c2e5681b404f72684a592349290672
7
- data.tar.gz: 58b6317a5b5181b08adb35f7d9142b7e42d110584efcf7d00f97f678cf8c48a9a45f15feec0883c8f365f95d5de26572f817e64fcd48181d847620cd27c1d6f7
6
+ metadata.gz: 620dfa5f1e2cf91f71cf0c957700ba0f7f3eabd5e8d6fff35cc0761e97f88d972ca5123d6cbf026543aaa4678a42e81a494af77e34da1a5bf775a8ca53a48ba9
7
+ data.tar.gz: 6eea3f9256a07c74ae39b23f921e439f9e6b22fe72d054e139e64645b78217d93369645547b131eb8424a7c6404ad04e81b951282fc2efa838c5257df66f58c8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -11,13 +11,33 @@ class KjReading
11
11
 
12
12
  bible = Kj::Bible.new
13
13
 
14
- r = s.match(/(?<book>\w+)\s+(?<chapter>\d+),\s*(?<verses>.*)/)
15
- verses = r[:verses] =~ /\.\./ ? \
16
- Range.new(*r[:verses].split(/\.\./).map(&:to_i)).to_a : r[:verses]
17
- bible.books(r[:book])[0].chapter(r[:chapter]).verses(verses).join(' ')
14
+ 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"
18
22
 
19
- end
23
+ end.join
20
24
 
25
+ end
26
+
27
+ def self.abbrev(s)
28
+
29
+ Kj::Bible.new.books(s)[0].abbreviations
30
+
31
+ end
32
+
33
+ def self.books()
34
+
35
+ h = Kj::Bible.new.books.inject({}) do |r,x|
36
+ r.merge(x.name.downcase => x.abbreviations.split(','))
37
+ end
38
+
39
+ end
40
+
21
41
  def self.check(s)
22
42
  Kj::Bible.new.books(s)[0].name
23
43
  end
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  sB6wQxY9xLzIB9fpQFU2y+zLTh80VMYQNuE8eXjXMmSEK9wob9e0IUVSJ0ClxuFh
31
31
  xqg=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-06-28 00:00:00.000000000 Z
33
+ date: 2018-07-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: kj
metadata.gz.sig CHANGED
Binary file