agnostic_slugs 0.0.1 → 0.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: 60d42bf414ee63ea0fff3b603f39d81ef623c055
4
- data.tar.gz: aec643b42421f40dc26b1757c848018ca86639de
3
+ metadata.gz: a727c621171eafe0e9a81d34dc63c1e9f67b789f
4
+ data.tar.gz: ec13fdb7d13c83cab6ee103bafe46cb5ab453ca7
5
5
  SHA512:
6
- metadata.gz: 800a7886f1002f94b05c1edbf4af3feae6c9d05b563457cc5745d6906ff17650cf91557811eee6228914e44f5ff2403f123bb8da967f670d94206d649035fd47
7
- data.tar.gz: 36a809879ccc72f27a10fd687fc77b56a9a7d806b9fed663be77afe681179514d2616dc7bb8bbcdb9aadf64d0029603c14a400f337d4f1d153f2a0e37b7ed091
6
+ metadata.gz: efffd84b8efa869d40b9c39b9943cadb849640f1ae87b5a6801a00901ce27686ead42abc558ffbbfa2dccc523bd0dde8b2fab48a20a6c95a70651c7ac46eb3f2
7
+ data.tar.gz: a0c078d024f7766e67a4db03adcc853c988ce95571dd81857b3a3358ef72b638bec530e716a142aa69897dfea6e3c564bee339b2c40bb8587238064d00f9269e
@@ -1,3 +1,7 @@
1
+ # 0.0.2
2
+
3
+ * Can handle leading and trailing dashes
4
+
1
5
  # 0.0.1
2
6
 
3
7
  Initial version with basic functionality
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # AgnosticSlugs
1
+ # agnostic_slugs
2
2
 
3
3
  agnostic_slugs is a simple slug generator that is agnostic.
4
4
 
@@ -17,13 +17,15 @@ gem 'agnostic_slugs'
17
17
 
18
18
  ## Usage
19
19
 
20
- slug = AgnosticSlugs::Slug.new('Look at my pretty new shoes! :)')
21
- slug.to_s # => "look-at-my-pretty-new-shoes"
22
- slug.next.to_s # => "look-at-my-pretty-new-shoes-2"
20
+ ```ruby
21
+ slug = AgnosticSlugs::Slug.new('Look at my pretty new shoes! :)')
22
+ slug.to_s # => "look-at-my-pretty-new-shoes"
23
+ slug.next.to_s # => "look-at-my-pretty-new-shoes-2"
24
+ ```
23
25
 
24
26
  ## Contributing
25
27
 
26
- 1. Fork it ( https://github.com/[my-github-username]/agnostic_slugs/fork )
28
+ 1. Fork it ( https://github.com/lasseebert/agnostic_slugs/fork )
27
29
  2. Create your feature branch (`git checkout -b my-new-feature`)
28
30
  3. Commit your changes (`git commit -am 'Add some feature'`)
29
31
  4. Push to the branch (`git push origin my-new-feature`)
@@ -24,6 +24,9 @@ module AgnosticSlugs
24
24
  result = result.downcase
25
25
  result = result.gsub(/[^a-z0-9\-]/, '')
26
26
 
27
+ # Remove leading and trailing dash
28
+ result = result.sub(/^-/, '').sub(/-$/, '')
29
+
27
30
  if counter > 1
28
31
  "#{result}-#{counter}"
29
32
  else
@@ -1,3 +1,3 @@
1
1
  module AgnosticSlugs
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
@@ -27,6 +27,11 @@ module AgnosticSlugs
27
27
  let(:counter) { 2 }
28
28
  it { should eq('hello-world-2') }
29
29
  end
30
+
31
+ describe 'with leading and trailing spaces' do
32
+ let(:input) { ' Hello world ' }
33
+ it { should eq('hello-world') }
34
+ end
30
35
  end
31
36
 
32
37
  describe '#next' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agnostic_slugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Skindstad Ebert