webget_ruby_unaccent 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ 4 1+�>��<f��+jl�?4$��P��~��rA����\����v��wzj�H��$"���ٮ�X�d���[����t�⋣�Tz2����W�=І��(��Jꬿ��
2
+ �(��!��w�R$
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+
3
+ You may choose any of these licenses:
4
+
5
+ - CreativeCommons License, Non-commercial Share Alike
6
+ - LGPL, GNU Lesser General Public License
7
+ - MIT License
8
+ - Ruby License
9
+
10
+ THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@@ -0,0 +1 @@
1
+ -*- encoding: utf-8 -*-
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin rdoc
4
+
5
+ = WebGet Ruby Gem: Unaccent
6
+
7
+ Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
8
+ Copyright:: Copyright (c) 2006-2010 Joel Parker Henderson
9
+ License:: CreativeCommons License, Non-commercial Share Alike
10
+ License:: LGPL, GNU Lesser General Public License
11
+
12
+ Replace a string's accent characters with ASCII characters.
13
+
14
+ =end
15
+
16
+
17
+ class String
18
+
19
+ ACCENT_HASH = Hash[*'À A Á A  A à A Ä A Å AA Æ AE Ç C Ð D È E É E Ê E Ë E Ì I Í I Î I Ï I Ł L Ñ N Ò O Ó O Ô O Õ O Ö O Ø OE Œ OE Ù U Ú U Ü U Û U Ý Y Þ Th ß ss à a á a â a ã a ä a å aa ā a ă a æ ae ç c ć c č c ĉ c ċ c ď d đ d ð d è e é e ê e ë e ē e ę e ě e ĕ e ė e ƒ f ĝ g ğ g ġ g ģ g ĥ h ħ h ì i í i î i ï i ī i ĩ i ĭ i į j ı j ij ij ĵ j ķ k ĸ k ł l ľ l ĺ l ļ l ŀ l ł l ñ n ń n ň n ņ n ʼn n ŋ n ò o ó o ô o õ o ō o ö o ŏ o ŏ o ø oe ø oe œ oe ą q ŕ r ř r ŗ r ś s š s ş s ŝ s ș s ť t ţ t ŧ t ț t ù u ú u û u ū u ü u ů u ű u ŭ u ũ u ų u ŵ w ý y ÿ y ŷ y ž z ż z ź z þ th ÿ y & and'.split]
20
+
21
+ # Replace a string's accent characters with ASCII characters.
22
+ #
23
+ # ==Example
24
+ # s = "Å Ç ß"
25
+ # s.unaccent = > "AA C ss"
26
+
27
+ def unaccent
28
+ split(//u).map {|c| ACCENT_HASH[c] || c }.join("")
29
+ end
30
+
31
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'test/unit'
3
+ require 'webget_ruby_unaccent'
4
+
5
+ class StringTest < Test::Unit::TestCase
6
+
7
+ def test_with_all_unaccented
8
+ assert_equal("abc","abc".unaccent)
9
+ end
10
+
11
+ def test_with_all_accented
12
+ assert_equal("AA AE Th ss d and","Å Æ Þ ß ď &".unaccent)
13
+ end
14
+
15
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webget_ruby_unaccent
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - WebGet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDvDCCAyWgAwIBAgIJAIlSqEkDQaZIMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYD
14
+ VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5j
15
+ aXNjbzETMBEGA1UEChMKV2ViR2V0LmNvbTETMBEGA1UECxMKV2ViR2V0LmNvbTET
16
+ MBEGA1UEAxMKV2ViR2V0LmNvbTEgMB4GCSqGSIb3DQEJARYRd2ViZ2V0QHdlYmdl
17
+ d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1qIcZjcTovhzgcixpG6Uk5qmUsKHRLQf4oQJx7TfLK
33
+ -----END CERTIFICATE-----
34
+
35
+ date: 2010-03-09 00:00:00 -08:00
36
+ default_executable:
37
+ dependencies: []
38
+
39
+ description:
40
+ email: webget@webget.com
41
+ executables: []
42
+
43
+ extensions: []
44
+
45
+ extra_rdoc_files: []
46
+
47
+ files:
48
+ - README.rdoc
49
+ - LICENSE.txt
50
+ - lib/webget_ruby_unaccent.rb
51
+ has_rdoc: true
52
+ homepage: http://webget.com/
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.5
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: "WebGet Ruby Gem: Unaccent to replace a string's accent characters"
79
+ test_files:
80
+ - test/webget_ruby_unaccent_test.rb
Binary file