summarise 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/summarise/string_extensions.rb +7 -3
- data/lib/summarise/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd42215f8bf26f1a2a6ddf1b5e122519a61b1bd
|
4
|
+
data.tar.gz: f7c3c7ca67e2557eb86098999e4cf63a52539e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6d598573b183a85a331e90a323956ba3abe3e2bf390f3a163c536cdea41350c8e7656f33f5ef1a61ee90e33698f238e44305f97d8f20456383535ae297909e5
|
7
|
+
data.tar.gz: 9115804488f9eb3d628c93801ef3d16f05700ce0b4ba8f058df04e89b108ff09184f23d66def7303878c05e44d951af6c2c686b58ded5691164befed9dc7a2b6
|
@@ -1,10 +1,14 @@
|
|
1
1
|
|
2
2
|
module Summarise
|
3
3
|
module StringExtensions
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
def summarize(l=200, args={})
|
5
|
+
i = 0
|
6
|
+
summary = self.split.map{ |word| word if (i += word.length) < l}.compact.join(' ')
|
7
|
+
if args[:suffix] && self != summary
|
8
|
+
summary << args[:suffix]
|
7
9
|
end
|
10
|
+
summary
|
11
|
+
end
|
8
12
|
|
9
13
|
def summarisable?(length=200)
|
10
14
|
return self.summarise(length) != self
|
data/lib/summarise/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: summarise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|