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 CHANGED
@@ -1,8 +1,16 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 2.1.4
5
+ -----
6
+
7
+ *April 6, 2012*
8
+
9
+ * BUG FIX - NetBible was broken after the Helper::Text reorg. This
10
+ releases fixes the bug.
11
+
4
12
  2.1.3
5
- -----------------
13
+ -----
6
14
 
7
15
  *April 5, 2012*
8
16
 
data/bin/votd CHANGED
@@ -14,11 +14,11 @@ votd = Votd::BibleGateway.new
14
14
 
15
15
  LINE_WIDTH = 40
16
16
 
17
- puts banner(LINE_WIDTH) { "VERSE OF THE DAY for #{votd.date.to_s}" }
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(LINE_WIDTH) { word_wrap(votd.copyright, LINE_WIDTH) }
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
- # @return [String] the VotD formatted as custom HTML
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
- # @return [String] the VotD formatted as custom text
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, for example. Use with a block.
8
+ # utility.
9
9
  # @example
10
- # banner(20) { "My Banner" }
10
+ # banner("My Banner", 20)
11
11
  #
12
12
  # ->
13
13
  # ====================
14
- # My Banner
14
+ # My Banner
15
15
  # ====================
16
16
  # @param [Integer] line_width number of columns for width
17
- # @return [String] the banner text
18
- def banner(line_width=40)
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 << yield.center(line_width)
22
+ banner_text << text.center(line_width)
22
23
  banner_text << "\n"
23
- banner_text << "=" * line_width
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
@@ -1,4 +1,4 @@
1
1
  module Votd
2
2
  # Gem version number
3
- VERSION = "2.1.3"
3
+ VERSION = "2.1.4"
4
4
  end
@@ -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
- banner(6){ "foo" }.should == "======\n foo \n======"
9
+ $stdout.should_receive(:puts).with("======\n foo \n======")
10
+ banner("foo", 6)
10
11
  end
11
12
  end
12
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: votd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: