ohgiri 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/ohgiri.rb +2 -2
- data/ohgiri.gemspec +1 -1
- data/spec/ohgiri_spec.rb +14 -5
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -12,7 +12,7 @@ Simple library to shorten the text by the specified length.
|
|
12
12
|
# => "Not that I ..."
|
13
13
|
|
14
14
|
"All that glitters is not gold.".shorten(100)
|
15
|
-
# => "All that
|
15
|
+
# => "All that glitters is not gold."
|
16
16
|
|
17
17
|
"But break, my heart, for I must hold my tongue.".shorten
|
18
18
|
# => "But bre..."
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/ohgiri.rb
CHANGED
data/ohgiri.gemspec
CHANGED
data/spec/ohgiri_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
3
|
|
4
4
|
describe "Ohgiri" do
|
5
|
-
let(:long_text) { String.new("There are more things in heaven and earth, Horatio.Than are dreamt of in your philosophy.") }
|
5
|
+
let(:long_text) { String.new("There are more things in heaven and earth, Horatio. Than are dreamt of in your philosophy.") }
|
6
6
|
let(:ten_characters_text) { String.new("invitation") }
|
7
7
|
let(:short_text) { String.new("Ophelia") }
|
8
8
|
let(:japanese_text) { String.new("智に働けば角が立つ。 情に棹させば流される。 意地を通せば窮屈だ。 とかくに人の世は住みにくい。") }
|
@@ -30,11 +30,20 @@ describe "Ohgiri" do
|
|
30
30
|
it "should returns shortened Japanese string in specified length" do
|
31
31
|
japanese_text.shorten(20).should eq("智に働けば角が立つ。 情に棹させば...")
|
32
32
|
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
33
|
|
34
|
+
it "should returns shortened string with assigned ellipsis" do
|
35
|
+
long_text.shorten(20, '*').should eq("There are more thin*")
|
36
|
+
end
|
38
37
|
|
38
|
+
it "should returns shortened Japanese string with assigned ellipsis" do
|
39
|
+
japanese_text.shorten(20, '--').should eq("智に働けば角が立つ。 情に棹させば流--")
|
40
|
+
end
|
39
41
|
|
42
|
+
it "should returns shortened string with assigned ellipsis by Japanese characters" do
|
43
|
+
long_text.shorten(20, '以下略').should eq("There are more th以下略")
|
44
|
+
end
|
40
45
|
|
46
|
+
it "should returns ellipsis string if assigned ellipsis is longer than specified length" do
|
47
|
+
long_text.shorten(3, '以下省略').should eq("以下省略")
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohgiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash: -
|
112
|
+
hash: -1766940211948418941
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|