babosa 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/lib/babosa/utf8/active_support_proxy.rb +12 -0
- data/lib/babosa/version.rb +1 -1
- data/spec/utf8_proxy_spec.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63fa1835d7bbc606c85b2c8315e8619c37bc7703
|
4
|
+
data.tar.gz: 4b0f3a169ed08de3a1614026e58fbc0dc00e58bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8581a919789c35ab9fe3c077190dcb93a20da9b0ed5ebf05cb7342fb2c4c9eeb8181e3d93850fd7564f31e95cd0195274f24e2fde938c7e6c9027aa02a4ccd15
|
7
|
+
data.tar.gz: 6a86041c30dcd1cdbf5a39b1d2f319425656e57135856aa90a32fffd181fe85748676f74fbb25254294f8d8c6c63f1574b087a32f1d2d112ce84ae40f932c8b4
|
data/Changelog.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'active_support'
|
1
2
|
require 'active_support/multibyte/unicode'
|
2
3
|
|
3
4
|
module Babosa
|
@@ -5,10 +6,21 @@ module Babosa
|
|
5
6
|
# A UTF-8 proxy using Active Support's multibyte support.
|
6
7
|
module ActiveSupportProxy
|
7
8
|
extend ActiveSupport::Multibyte::Unicode
|
9
|
+
extend self
|
8
10
|
|
9
11
|
def self.normalize_utf8(string)
|
10
12
|
normalize(string, :c)
|
11
13
|
end
|
14
|
+
|
15
|
+
if ActiveSupport::VERSION::MAJOR == 3
|
16
|
+
def downcase(string)
|
17
|
+
ActiveSupport::Multibyte::Chars.new(string).downcase.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def upcase(string)
|
21
|
+
ActiveSupport::Multibyte::Chars.new(string).upcase.to_s
|
22
|
+
end
|
23
|
+
end
|
12
24
|
end
|
13
25
|
end
|
14
26
|
end
|
data/lib/babosa/version.rb
CHANGED
data/spec/utf8_proxy_spec.rb
CHANGED
@@ -8,6 +8,16 @@ PROXIES.each do |proxy|
|
|
8
8
|
|
9
9
|
describe proxy do
|
10
10
|
|
11
|
+
around do |example|
|
12
|
+
begin
|
13
|
+
old_proxy = Babosa::Identifier.utf8_proxy
|
14
|
+
Babosa::Identifier.utf8_proxy = proxy
|
15
|
+
example.run
|
16
|
+
ensure
|
17
|
+
Babosa::Identifier.utf8_proxy = old_proxy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
11
21
|
describe "#normalize_utf8" do
|
12
22
|
it "should normalize to canonical composed" do
|
13
23
|
# ÅÉÎØÜ
|
@@ -21,12 +31,14 @@ PROXIES.each do |proxy|
|
|
21
31
|
describe "#upcase" do
|
22
32
|
it "should upcase the string" do
|
23
33
|
expect(proxy.upcase("åéîøü")).to eql("ÅÉÎØÜ")
|
34
|
+
expect("åéîøü".to_identifier.upcase).to eql("ÅÉÎØÜ")
|
24
35
|
end
|
25
36
|
end
|
26
37
|
|
27
38
|
describe "#downcase" do
|
28
39
|
it "should downcase the string" do
|
29
40
|
expect(proxy.downcase("ÅÉÎØÜ")).to eql("åéîøü")
|
41
|
+
expect("ÅÉÎØÜ".to_identifier.downcase).to eql("åéîøü")
|
30
42
|
end
|
31
43
|
end
|
32
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babosa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norman Clarke
|
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
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.4.
|
160
|
+
rubygems_version: 2.4.4
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: A library for creating slugs.
|