content_truncate 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,7 @@ module ContentTruncate
24
24
  end
25
25
  sep = separators.shift
26
26
  end
27
+ return self[0...limit_length].strip
27
28
  end
28
29
  end
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module ContentTruncate
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -27,4 +27,8 @@ class ContentTruncateTest < Test::Unit::TestCase
27
27
  def test_content_truncate_for_include_sep
28
28
  assert_equal "Truncate a string down to \n x characters. <br/>", mock_string.content_truncate(48, "。", "<br/>")
29
29
  end
30
+
31
+ def test_content_truncate_for_nil_match
32
+ assert_equal "测试中文无", "测试中文无符号".content_truncate(5, "。", "<br/>")
33
+ end
30
34
  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.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
12
+ date: 2013-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport