fedux_org-stdlib 0.11.9 → 0.11.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/core_ext/string/characterize.rb +4 -5
- data/lib/fedux_org_stdlib/core_ext/string/transliterate.rb +22 -0
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/lib/fedux_org_stdlib/zipper.rb +1 -1
- data/spec/core_ext/string/characterize_spec.rb +5 -1
- data/spec/core_ext/string/transliterate.rb +18 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6841dfdb44dda71248d9db8d5d9f950c4b8947
|
4
|
+
data.tar.gz: cb82cb72e7dcd123f87a4a233ec233d3223be407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab158f3098a40eaa21c2e1d7a1ec575937a994cd79e1963777b21fea2780825072d57d7e86164a0f490f0098a65fe346fc871853d87b786491b8182602418704
|
7
|
+
data.tar.gz: 7d728613a023f6377120dc3bce8eb26fa27f966ce9b6ae183584173ae5a409c8cd3012973015544b5e5d37ce0cab8c50943a36193a5dc0e585162c550102e53e
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'fedux_org_stdlib/
|
3
|
-
require_library %w(active_support/core_ext/string/strip active_support/core_ext/string/inflections)
|
2
|
+
require 'fedux_org_stdlib/core_ext/string/transliterate'
|
4
3
|
|
5
4
|
# String
|
6
5
|
class String
|
@@ -10,9 +9,9 @@ class String
|
|
10
9
|
#
|
11
10
|
# @example Simple Example
|
12
11
|
#
|
13
|
-
# '
|
14
|
-
# #=> '
|
12
|
+
# 'Donald E. Knütz'.characterize
|
13
|
+
# #=> 'donald-e-knuth'
|
15
14
|
def characterize
|
16
|
-
|
15
|
+
transliterate.parameterize
|
17
16
|
end
|
18
17
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'fedux_org_stdlib/require_files'
|
3
|
+
require_library %w(active_support/inflector/transliterate)
|
4
|
+
|
5
|
+
# String
|
6
|
+
class String
|
7
|
+
# Make umlauts less special
|
8
|
+
#
|
9
|
+
# This will remove accents and umlauts and other specialities from
|
10
|
+
# characters.
|
11
|
+
#
|
12
|
+
# ä => a
|
13
|
+
# á => a
|
14
|
+
#
|
15
|
+
# @example Simple Example
|
16
|
+
#
|
17
|
+
# 'Donald E. Knütz'.transliterate
|
18
|
+
# #=> 'Donald E. Knutz'
|
19
|
+
def transliterate
|
20
|
+
ActiveSupport::Inflector.transliterate(self)
|
21
|
+
end
|
22
|
+
end
|
@@ -4,7 +4,7 @@ require_library %w(zip zip/filesystem active_support/core_ext/object/blank)
|
|
4
4
|
|
5
5
|
module FeduxOrgStdlib
|
6
6
|
module Zipper
|
7
|
-
def unzip(source_file, destination_directory)
|
7
|
+
def unzip(source_file, destination_directory = Dir.getwd)
|
8
8
|
return unless destination_directory
|
9
9
|
|
10
10
|
Zip::File.open(source_file) do |z|
|
@@ -3,7 +3,7 @@ require 'fedux_org_stdlib/core_ext/string/characterize'
|
|
3
3
|
|
4
4
|
RSpec.describe String do
|
5
5
|
context '#characterize' do
|
6
|
-
it 'removes accents' do
|
6
|
+
it 'removes accents and whitespace' do
|
7
7
|
expect('á'.characterize).to eq 'a'
|
8
8
|
end
|
9
9
|
|
@@ -14,5 +14,9 @@ RSpec.describe String do
|
|
14
14
|
it 'removes special characters "§$%&/()=?!\t' do
|
15
15
|
expect(%('°^!"§$%&/()=?!\t).characterize).to eq ''
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'removes whitespace' do
|
19
|
+
expect(%(Donald E. Knuth).characterize).to eq 'donald-e-knuth'
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'fedux_org_stdlib/core_ext/string/transliterate'
|
3
|
+
|
4
|
+
RSpec.describe String do
|
5
|
+
context '#transliterate' do
|
6
|
+
it 'removes accents' do
|
7
|
+
expect('á'.transliterate).to eq 'a'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'removes umlauts' do
|
11
|
+
expect('ä'.transliterate).to eq 'a'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'removes special characters "§$%&/()=?!\t' do
|
15
|
+
expect(%('°^!"§$%&/()=?!\t).transliterate).to eq ''
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/fedux_org_stdlib/core_ext/shellwords/clean.rb
|
75
75
|
- lib/fedux_org_stdlib/core_ext/string.rb
|
76
76
|
- lib/fedux_org_stdlib/core_ext/string/characterize.rb
|
77
|
+
- lib/fedux_org_stdlib/core_ext/string/transliterate.rb
|
77
78
|
- lib/fedux_org_stdlib/core_ext/string/underline.rb
|
78
79
|
- lib/fedux_org_stdlib/directory_finder.rb
|
79
80
|
- lib/fedux_org_stdlib/directory_finder/exceptions.rb
|
@@ -189,6 +190,7 @@ files:
|
|
189
190
|
- spec/core_ext/hash/options_spec.rb
|
190
191
|
- spec/core_ext/shellwords/clean_spec.rb
|
191
192
|
- spec/core_ext/string/characterize_spec.rb
|
193
|
+
- spec/core_ext/string/transliterate.rb
|
192
194
|
- spec/core_ext/string/underline_spec.rb
|
193
195
|
- spec/directory_finder_spec.rb
|
194
196
|
- spec/editor_spec.rb
|
@@ -277,6 +279,7 @@ test_files:
|
|
277
279
|
- spec/core_ext/hash/options_spec.rb
|
278
280
|
- spec/core_ext/shellwords/clean_spec.rb
|
279
281
|
- spec/core_ext/string/characterize_spec.rb
|
282
|
+
- spec/core_ext/string/transliterate.rb
|
280
283
|
- spec/core_ext/string/underline_spec.rb
|
281
284
|
- spec/directory_finder_spec.rb
|
282
285
|
- spec/editor_spec.rb
|