web-utils 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 8df71a71864afc54ccfe22398682022e6cf090910aae975b32eed9d35e9286e8
4
- data.tar.gz: c703eab7a05aeb5012c2329ae97baf37deca08adc54a5a271764bbba7e8b1af9
3
+ metadata.gz: d8a2315d2048160a727547e8e9244d42dfb06872b8d2e033116284aa951c3e7e
4
+ data.tar.gz: 48008168ad2f44ff6b8f5b783b03a8f529e59b235b3b619a9975695172b23493
5
5
  SHA512:
6
- metadata.gz: f5e299b79e26e7115969862e9fda94cab8adc13fae528ddf9b7ec3aa4e9259f415942e0b957c41e6ff8531b9d56f09ae2f40cbb66c26ea15edb39cdbefad0680
7
- data.tar.gz: 932b896280ae5139b81c78c610fff132516d5ed9559dc87c65b51779d61b8f77a22825ccd79acda14fdb27fb9e20e2aed3a68327b2c3160fed582ca3842b535f
6
+ metadata.gz: 5337eedf0e98063f1a7aabea4650db6c5d8bb7c20f8ab1b65f887d1374c1fb8351ae5fd27f0bcb7d8c9adb8076cfdd42beefa8980bf688cf66788ca98f842d46
7
+ data.tar.gz: a88b9779b1229f8d499e68b47c466a298f9181d5fd866890057f5a59a0f247647e921ad5a531fa6c550b1db179dc7eb93306c55aa8a48332800704624c94ec68
data/lib/web_utils.rb CHANGED
@@ -5,7 +5,7 @@ require 'uri'
5
5
 
6
6
  module WebUtils
7
7
 
8
- VERSION = '0.1.2'
8
+ VERSION = '0.1.3'
9
9
 
10
10
  # Most methods are supposed to be as simple as possible
11
11
  # and just cover most cases.
@@ -115,9 +115,9 @@ module WebUtils
115
115
  def slugify s, force_lower=true
116
116
  s = s.to_s
117
117
  .tr(ACCENTS, WITHOUT_ACCENTS)
118
- .tr('.,;:?!/\'"()[]{}<>','-')
119
118
  .gsub(/&/, 'and')
120
- .gsub(/[[:space:]\-]+/,'-')
119
+ .gsub(/%/, ' percent')
120
+ .gsub(/(\-|[^0-9a-zA-Z])+/,'-')
121
121
  .gsub(/(^-|-$)/,'')
122
122
  s = s.downcase if force_lower
123
123
  escape(s)
@@ -232,13 +232,13 @@ describe WebUtils do
232
232
  # For making slug for a document
233
233
  # Possibly used instead of the id
234
234
 
235
- let(:arg) { "Así es la vida by Daniel Bär & Mickaël ? (100%)" }
235
+ let(:arg) { "Así es la vida by Daniel Bär & Mickaël ? (100%) ~ " }
236
236
  it 'Builds a string made of lowercase URL-friendly chars' do
237
- assert_equal 'asi-es-la-vida-by-daniel-bar-and-mickael-100%25', utils.slugify(arg)
237
+ assert_equal 'asi-es-la-vida-by-daniel-bar-and-mickael-100-percent', utils.slugify(arg)
238
238
  end
239
239
  describe 'when second argument is false' do
240
240
  it 'Does not force to lowercase' do
241
- assert_equal 'Asi-es-la-vida-by-Daniel-Bar-and-Mickael-100%25', utils.slugify(arg,false)
241
+ assert_equal 'Asi-es-la-vida-by-Daniel-Bar-and-Mickael-100-percent', utils.slugify(arg,false)
242
242
  end
243
243
  end
244
244
  describe 'when argument is nil' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickael Riga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack