pericope 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cli/base.rb +0 -12
- data/lib/cli/command.rb +0 -8
- data/lib/pericope.rb +21 -9
- data/lib/pericope/cli.rb +1 -11
- data/lib/pericope/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e48633c3d81555ea2a699d359437bcbebfae2c3
|
4
|
+
data.tar.gz: b9017728cd671d4c9d24ed5612ffbf6459e38068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 280f67bd0faf5654e48a15971ef1874df15b3a5802ad146b27367acb3dc95b3758278c889bf77ab0708c51ecd42886c92340ab825dda1b8880d433478dd8e0fd
|
7
|
+
data.tar.gz: e14e5dadefe61d965613f312d4b14e67566837ef248ae3b0d6bf2abb726f905397760d20b779d314e0b9b8e7327ac8e6fc7f8b2fdd17533fedea7c0ba1702ae8
|
data/lib/cli/base.rb
CHANGED
@@ -1,30 +1,18 @@
|
|
1
1
|
module CLI
|
2
2
|
class Base
|
3
3
|
|
4
|
-
|
5
|
-
|
6
4
|
def self.command(name, description, &block)
|
7
|
-
|
8
5
|
end
|
9
6
|
|
10
|
-
|
11
|
-
|
12
7
|
def self.print_commands
|
13
8
|
usage = ""
|
14
|
-
|
15
9
|
end
|
16
10
|
|
17
|
-
|
18
|
-
|
19
11
|
private
|
20
12
|
|
21
|
-
|
22
|
-
|
23
13
|
def commands
|
24
14
|
@commands || {}
|
25
15
|
end
|
26
16
|
|
27
|
-
|
28
|
-
|
29
17
|
end
|
30
18
|
end
|
data/lib/cli/command.rb
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
module CLI
|
2
2
|
class Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
4
|
def initialize(name, description, &block)
|
7
5
|
@name, @description, @block = name, description, &block
|
8
6
|
end
|
9
7
|
|
10
|
-
|
11
|
-
|
12
8
|
attr_reader :name, :description
|
13
9
|
|
14
|
-
|
15
|
-
|
16
10
|
def execute
|
17
11
|
@block.call
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
14
|
end
|
23
15
|
end
|
data/lib/pericope.rb
CHANGED
@@ -20,6 +20,10 @@ class Pericope
|
|
20
20
|
@ranges = Pericope.group_array_into_ranges(arg)
|
21
21
|
|
22
22
|
when Range
|
23
|
+
STDERR.puts "DEPRECATION WARNING: instantiating a pericope with a single range is deprecated and will be removed in pericope 1.0.",
|
24
|
+
"",
|
25
|
+
" You can change `Pericope.new(range)` to `Pericope.new(range.to_a)`",
|
26
|
+
""
|
23
27
|
set_book Pericope.get_book(arg.begin)
|
24
28
|
@ranges = [arg]
|
25
29
|
|
@@ -101,8 +105,12 @@ class Pericope
|
|
101
105
|
|
102
106
|
|
103
107
|
def self.sub(text)
|
104
|
-
|
105
|
-
|
108
|
+
STDERR.puts "DEPRECATION WARNING: Pericope.sub is deprecated and will be removed in pericope 1.0.",
|
109
|
+
"",
|
110
|
+
" You can use `Pericope.split` with `inject` to replace pericopes in a block of text",
|
111
|
+
""
|
112
|
+
|
113
|
+
split(text).inject("") do |text, segment|
|
106
114
|
if segment.is_a?(String)
|
107
115
|
text << segment
|
108
116
|
else
|
@@ -114,6 +122,8 @@ class Pericope
|
|
114
122
|
|
115
123
|
|
116
124
|
def self.rsub(text)
|
125
|
+
STDERR.puts "DEPRECATION WARNING: Pericope.rsub is deprecated and will be removed in pericope 1.0."
|
126
|
+
|
117
127
|
text.gsub(/\{\{(\d{7,8} ?)+\}\}/) do |match|
|
118
128
|
ids = match[2...-2].split.collect(&:to_i)
|
119
129
|
Pericope.new(ids).to_s
|
@@ -138,6 +148,10 @@ class Pericope
|
|
138
148
|
[book, ranges].hash
|
139
149
|
end
|
140
150
|
|
151
|
+
def <=>(other)
|
152
|
+
to_a <=> other.to_a
|
153
|
+
end
|
154
|
+
|
141
155
|
|
142
156
|
|
143
157
|
def to_a
|
@@ -173,6 +187,7 @@ class Pericope
|
|
173
187
|
verse_list_separator = options.fetch(:verse_list_separator, ", ")
|
174
188
|
chapter_list_separator = options.fetch(:chapter_list_separator, "; ")
|
175
189
|
always_print_verse_range = options.fetch(:always_print_verse_range, false)
|
190
|
+
always_print_verse_range = true unless book_has_chapters?
|
176
191
|
|
177
192
|
s = ""
|
178
193
|
ranges.each_with_index do |range, i|
|
@@ -219,9 +234,9 @@ class Pericope
|
|
219
234
|
|
220
235
|
def intersects?(pericope)
|
221
236
|
return false unless pericope.is_a?(Pericope)
|
222
|
-
return false unless
|
237
|
+
return false unless book == pericope.book
|
223
238
|
|
224
|
-
|
239
|
+
ranges.each do |self_range|
|
225
240
|
pericope.ranges.each do |other_range|
|
226
241
|
return true if (self_range.end >= other_range.begin) and (self_range.begin <= other_range.end)
|
227
242
|
end
|
@@ -373,14 +388,11 @@ private
|
|
373
388
|
end
|
374
389
|
|
375
390
|
def self.parse_reference(book, reference)
|
376
|
-
|
377
|
-
parse_ranges(book, reference.split(/[,;]/))
|
391
|
+
parse_ranges(book, normalize_reference(reference).split(/[,;]/))
|
378
392
|
end
|
379
393
|
|
380
394
|
def self.normalize_reference(reference)
|
381
|
-
reference
|
382
|
-
NORMALIZATIONS.each { |(regex, replacement)| reference.gsub!(regex, replacement) }
|
383
|
-
reference
|
395
|
+
NORMALIZATIONS.reduce(reference.to_s) { |reference, (regex, replacement)| reference.gsub(regex, replacement) }
|
384
396
|
end
|
385
397
|
|
386
398
|
def self.parse_ranges(book, ranges)
|
data/lib/pericope/cli.rb
CHANGED
@@ -98,8 +98,7 @@ Commands
|
|
98
98
|
|
99
99
|
|
100
100
|
private
|
101
|
-
|
102
|
-
|
101
|
+
attr_reader :options, :input
|
103
102
|
|
104
103
|
def initialize(*args)
|
105
104
|
@options = extract_options!(*args)
|
@@ -107,17 +106,8 @@ Commands
|
|
107
106
|
@input = $stdin.read if $stdin.stat.pipe?
|
108
107
|
end
|
109
108
|
|
110
|
-
|
111
|
-
|
112
|
-
attr_reader :options, :input
|
113
|
-
|
114
|
-
|
115
|
-
|
116
109
|
def extract_options!(*args)
|
117
110
|
{} # No options accepted yet
|
118
111
|
end
|
119
|
-
|
120
|
-
|
121
|
-
|
122
112
|
end
|
123
113
|
end
|
data/lib/pericope/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pericope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|