summarise 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a17eca01a7ed32cd9f137b142cab4fee60ced64e
4
- data.tar.gz: 655fdb30e18235bc103f1497bf87f508c369b983
3
+ metadata.gz: e6bdc7096f1b34e24a113899bc64c1ba97105154
4
+ data.tar.gz: 62a9a0c6a55bd88a2f92ca723fd209da364e8aa1
5
5
  SHA512:
6
- metadata.gz: 77b91fcfa1a2bc27830fa5278d2ea1e73bce820e97ae68f1aaf6197a32fcafc951168432049c7a55d1fa415e4603eb6a8e42c2ef136a111a098fd7b04755d208
7
- data.tar.gz: 51990392dbd351d07412316b4f086d66fe335c9e66391e196f9419fe972e42e806a2e3b9f97f8f5a48385592bcf07522ed080aaed84b04a5c4672a80fda1d53e
6
+ metadata.gz: 2196edf399c99a41371d0b0783915762f45b4b69b0b147b0d17ae4c386be606b2b990663595def20b13010db8382eb0b27cd986663278430bd2a4eb9d44de7e7
7
+ data.tar.gz: bdb9aeb4e3d93c806ade5800dd9ac73b4d7235bca32d509004b86478ea903844767f806053bdefb5fbe8d4b207fac6965239a9fecb169c52e0abee852f6a3d88
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # Summarise
2
2
 
3
- Summarise is a small gem which extends String, allowing you to create summaries of strings while respecting word boundaries.
3
+ Summarise is a small gem which extends String, allowing you to create summaries of strings while respecting word boundaries, something I need to do a lot.
4
4
 
5
5
  ## Usage
6
6
 
7
+ The length of the returned string is not guaranteed as it depends on the location of spaces. Simply call summarise on your string to get a version shortened to around 200 characters, or pass in a value to limit to that length instead.
8
+
9
+ Pass a suffix and shortened strings will have it appended to the end of them.
10
+
7
11
  str = "Summarise is a small gem which extends String, allowing you to create summaries."
8
12
 
9
13
  str.summarise 25
@@ -15,6 +19,18 @@ Summarise is a small gem which extends String, allowing you to create summaries
15
19
  str.summarise 5000, :suffix => "..."
16
20
  => "Summarise is a small gem which extends String, allowing you to create summaries."
17
21
 
22
+ You can also check if a string is summarisable like so:
23
+
24
+ # Default is 200 chars
25
+ str.summarisable?
26
+ => false
27
+
28
+ str.summarisable? 5000
29
+ => false
30
+
31
+ str.summarisable 30
32
+ => true
33
+
18
34
  ## Installation
19
35
 
20
36
  Add this line to your application's Gemfile:
@@ -1,14 +1,14 @@
1
1
 
2
2
  module Summarise
3
3
  module StringExtensions
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]
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]
9
+ end
10
+ summary
9
11
  end
10
- summary
11
- end
12
12
 
13
13
  def summarisable?(length=200)
14
14
  return self.summarise(length) != self
@@ -1,3 +1,3 @@
1
1
  module Summarise
2
- VERSION = "1.0.1"
3
- end
2
+ VERSION = "1.0.2"
3
+ end
data/summarise.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["nicholas@forwardadvance.com"]
11
11
  spec.description = %q{Adds a methods to allow you to summarise strings}
12
12
  spec.summary = %q{include the gem and call "abc".summarise}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/forwardadvance/summarise"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: summarise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Johnson
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Adds a methods to allow you to summarise strings
42
56
  email:
43
57
  - nicholas@forwardadvance.com
@@ -55,7 +69,7 @@ files:
55
69
  - lib/summarise/string_extensions.rb
56
70
  - lib/summarise/version.rb
57
71
  - summarise.gemspec
58
- homepage: ''
72
+ homepage: https://github.com/forwardadvance/summarise
59
73
  licenses:
60
74
  - MIT
61
75
  metadata: {}