votd 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +9 -1
- data/bin/votd +2 -2
- data/lib/votd/base.rb +8 -2
- data/lib/votd/helper/command_line.rb +10 -8
- data/lib/votd/netbible.rb +2 -3
- data/lib/votd/version.rb +1 -1
- data/spec/lib/votd/helper/command_line_spec.rb +2 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/bin/votd
CHANGED
@@ -14,11 +14,11 @@ votd = Votd::BibleGateway.new
|
|
14
14
|
|
15
15
|
LINE_WIDTH = 40
|
16
16
|
|
17
|
-
|
17
|
+
banner("VERSE OF THE DAY for #{votd.date.to_s}", LINE_WIDTH) { }
|
18
18
|
puts "\n"
|
19
19
|
puts word_wrap(votd.to_text, LINE_WIDTH)
|
20
20
|
|
21
21
|
if votd.copyright
|
22
22
|
puts "\n"
|
23
|
-
puts banner(
|
23
|
+
puts banner(word_wrap(votd.copyright, LINE_WIDTH), LINE_WIDTH)
|
24
24
|
end
|
data/lib/votd/base.rb
CHANGED
@@ -92,7 +92,10 @@ module Votd
|
|
92
92
|
# This returns the custom formatted HTML, or you can call the {#to_html} method
|
93
93
|
# when ready and your custom HTML will be output.
|
94
94
|
#
|
95
|
-
# @
|
95
|
+
# @yield [votd] the VotD itself
|
96
|
+
# @yieldparam [Base] votd the VotD itself
|
97
|
+
# @yieldreturn [String] the VotD formatted as custom HTML
|
98
|
+
# @raise {VotdError} when called without block format
|
96
99
|
def custom_html
|
97
100
|
if block_given?
|
98
101
|
@custom_html = yield(self)
|
@@ -124,7 +127,10 @@ module Votd
|
|
124
127
|
# This returns the custom formatted text, or you can call the {#to_text} method
|
125
128
|
# when ready, and your custom text will be output.
|
126
129
|
#
|
127
|
-
# @
|
130
|
+
# @yield [votd] the VotD itself
|
131
|
+
# @yieldparam [Base] votd the VotD itself
|
132
|
+
# @yieldreturn [String] the VotD formatted as custom text
|
133
|
+
# @raise {VotdError} when called without block format
|
128
134
|
def custom_text
|
129
135
|
if block_given?
|
130
136
|
@custom_text = yield(self)
|
@@ -5,23 +5,25 @@ module Votd
|
|
5
5
|
module CommandLine
|
6
6
|
extend self
|
7
7
|
# Generates a text banner suitable for displaying from a command-line
|
8
|
-
# utility
|
8
|
+
# utility.
|
9
9
|
# @example
|
10
|
-
# banner(
|
10
|
+
# banner("My Banner", 20)
|
11
11
|
#
|
12
12
|
# ->
|
13
13
|
# ====================
|
14
|
-
#
|
14
|
+
# My Banner
|
15
15
|
# ====================
|
16
16
|
# @param [Integer] line_width number of columns for width
|
17
|
-
# @
|
18
|
-
|
17
|
+
# @param [String] text text to print inside the banner
|
18
|
+
# @return [nil]
|
19
|
+
def banner(text, line_width=40)
|
19
20
|
banner_text = "=" * line_width
|
20
21
|
banner_text << "\n"
|
21
|
-
banner_text <<
|
22
|
+
banner_text << text.center(line_width)
|
22
23
|
banner_text << "\n"
|
23
|
-
banner_text <<
|
24
|
-
banner_text
|
24
|
+
banner_text << "=" * line_width
|
25
|
+
puts banner_text
|
26
|
+
nil
|
25
27
|
end
|
26
28
|
|
27
29
|
# Word-wraps text to the specified column width.
|
data/lib/votd/netbible.rb
CHANGED
@@ -39,10 +39,9 @@ module Votd
|
|
39
39
|
@reference = "#{bookname} #{chapter}:#{verse_numbers.join("-")}"
|
40
40
|
|
41
41
|
# build the text
|
42
|
-
#text = strip_html_tags(verses.join(" "))
|
43
42
|
text = Helper::Text.strip_html_tags(verses.join(" "))
|
44
|
-
text = clean_verse_start(text)
|
45
|
-
text = clean_verse_end(text)
|
43
|
+
text = Helper::Text.clean_verse_start(text)
|
44
|
+
text = Helper::Text.clean_verse_end(text)
|
46
45
|
|
47
46
|
@text = text
|
48
47
|
|
data/lib/votd/version.rb
CHANGED
@@ -6,7 +6,8 @@ include Votd::Helper::CommandLine
|
|
6
6
|
describe Votd::Helper::CommandLine do
|
7
7
|
describe "#banner" do
|
8
8
|
it "prints a banner wrapped at the correct location" do
|
9
|
-
|
9
|
+
$stdout.should_receive(:puts).with("======\n foo \n======")
|
10
|
+
banner("foo", 6)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|