kj 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/kj.gemspec +3 -3
- data/lib/kj/book.rb +6 -6
- data/lib/kj/chapter.rb +4 -4
- data/lib/kj/verse.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3c0f88d0a65cd67a819c6ede12a1295bfb061cf
|
4
|
+
data.tar.gz: 599c01ca8ad113d4662d1e3b4ab586f300dfe052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 717f461db4ca1b6c2ba3669f6582a93ed0cebad2bd4e21eaddbffe75a516e16760407123268576d2df5e38ecb2ff5a08e7d4e2baa4a624217a5c429d7d75e5b4
|
7
|
+
data.tar.gz: 35c4d11ad62a43379cde54204acbd8ab7a2b17fabb9a45638f0d39e885c8f0befd34c4968ecd262815f3ded82a77d12af52c1c06bac212a8cb88390e0b46ce09
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.16
|
data/kj.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: kj 0.0.
|
5
|
+
# stub: kj 0.0.16 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "kj"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.16"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["David John"]
|
14
|
-
s.date = "2015-08-
|
14
|
+
s.date = "2015-08-23"
|
15
15
|
s.description = "kj is a simple rubygem for accessing the King James Bible. It uses an embedded sqlite data store."
|
16
16
|
s.email = "djohn@arch-no.org"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/kj/book.rb
CHANGED
@@ -4,7 +4,7 @@ module Kj
|
|
4
4
|
|
5
5
|
class Book < Base
|
6
6
|
|
7
|
-
attr_accessor :id, :name, :permalink
|
7
|
+
attr_accessor :id, :name, :permalink, :abbreviations
|
8
8
|
|
9
9
|
def initialize(args)
|
10
10
|
args.each do |k,v|
|
@@ -34,15 +34,15 @@ module Kj
|
|
34
34
|
numbers = names_or_numbers.uniq.select{|n| n.is_a?(Integer)}
|
35
35
|
names = (names_or_numbers - numbers).uniq.map{|name| name.to_s.downcase}
|
36
36
|
results = []
|
37
|
-
results << Db.query("SELECT id, name, permalink FROM books WHERE id IN (#{numbers.join(',')})") if numbers.any?
|
38
|
-
names.each{ |name| results << Db.query("SELECT id, name FROM books WHERE abbreviations LIKE ? OR permalink = ?", ["%#{name.to_s}%", name.to_s]) }
|
39
|
-
results.flatten.map!{|book| new(id: book['id'], name: book['name'], permalink: book['permalink'])}.uniq.sort!{ |a,b| a.id <=> b.id }
|
37
|
+
results << Db.query("SELECT id, name, permalink, abbreviations FROM books WHERE id IN (#{numbers.join(',')})") if numbers.any?
|
38
|
+
names.each{ |name| results << Db.query("SELECT id, name, permalink, abbreviations FROM books WHERE abbreviations LIKE ? OR permalink = ?", ["%#{name.to_s}%", name.to_s]) }
|
39
|
+
results.flatten.map!{|book| new(id: book['id'], name: book['name'], permalink: book['permalink'], abbreviations: book['abbreviations'])}.uniq.sort!{ |a,b| a.id <=> b.id }
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.all
|
43
43
|
@all ||= begin
|
44
|
-
books = Db.query("SELECT id, name, permalink FROM books")
|
45
|
-
books.map{ |book| new(id: book['id'], name: book['name'], permalink: book['permalink']) }
|
44
|
+
books = Db.query("SELECT id, name, permalink, abbreviations FROM books")
|
45
|
+
books.map{ |book| new(id: book['id'], name: book['name'], permalink: book['permalink'], abbreviations: book['abbreviations']) }
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
data/lib/kj/chapter.rb
CHANGED
@@ -73,12 +73,12 @@ module Kj
|
|
73
73
|
def verses(*numbers)
|
74
74
|
if numbers.empty?
|
75
75
|
@verses ||= begin
|
76
|
-
results = Db.query("SELECT id, number FROM verses WHERE chapter_id = ?", [id])
|
77
|
-
results.map{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'])}
|
76
|
+
results = Db.query("SELECT id, number, page FROM verses WHERE chapter_id = ?", [id])
|
77
|
+
results.map{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'], page: verse['page'])}
|
78
78
|
end
|
79
79
|
else
|
80
|
-
results = Db.query("SELECT id, number FROM verses WHERE chapter_id = #{id} AND number IN (#{numbers.flatten.join(',')})")
|
81
|
-
results.map!{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'])}.sort!{ |a,b| a.id <=> b.id }
|
80
|
+
results = Db.query("SELECT id, number, page FROM verses WHERE chapter_id = #{id} AND number IN (#{numbers.flatten.join(',')})")
|
81
|
+
results.map!{|verse| Verse.new(id: verse['id'], book_name: book_name, chapter_id: id, number: verse['number'], page: verse['page'])}.sort!{ |a,b| a.id <=> b.id }
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
data/lib/kj/verse.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David John
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|