content_truncate 0.0.5 → 0.0.6

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.
@@ -20,7 +20,7 @@ module ContentTruncate
20
20
  while position && position <= limit_length
21
21
  prev_index, position = position, self.index(sep, position+1)
22
22
  end
23
- return self[0..(prev_index+sep.length)].strip
23
+ return self[0...(prev_index+sep.length)].strip
24
24
  end
25
25
  sep = separators.shift
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module ContentTruncate
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -5,7 +5,7 @@ require_relative '../lib/content_truncate'
5
5
  class ContentTruncateTest < Test::Unit::TestCase
6
6
 
7
7
  def mock_string
8
- "Truncate a string down to \n x characters. <br/> Beware of truncating \n text that has HTML elements in it."
8
+ "Truncate a string down to \n x characters. <br/>Beware of truncating \n text that has HTML elements in it."
9
9
  end
10
10
 
11
11
  def test_content_truncate_for_no_separator
@@ -23,4 +23,8 @@ class ContentTruncateTest < Test::Unit::TestCase
23
23
  def test_content_truncate_for_missing_char
24
24
  assert_equal "Truncate a string down to \n x characters. <br/>", mock_string.content_truncate(60, "。", "<br/>")
25
25
  end
26
+
27
+ def test_content_truncate_for_include_sep
28
+ assert_equal "Truncate a string down to \n x characters. <br/>", mock_string.content_truncate(48, "。", "<br/>")
29
+ end
26
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: content_truncate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: