accentless 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ Gemfile.lock
3
+ pkg/*
4
+ .*sw[op]
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour -f progress
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.2@accentless --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in accentless.gemspec
4
+ gemspec
data/README ADDED
File without changes
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "accentless/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "accentless"
7
+ s.version = Accentless::VERSION
8
+ s.authors = ["Lucas Souza"]
9
+ s.email = ["lucasas@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = ""
12
+ s.description = ""
13
+
14
+ s.rubyforge_project = "accentless"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency("rspec", ["~> 2.6.0"])
22
+ end
@@ -0,0 +1,2 @@
1
+ require "accentless/version"
2
+ require "accentless/extend_string"
@@ -0,0 +1,35 @@
1
+ class String
2
+ ACCENTS_MAPPING = {
3
+ 'E' => [200,201,202,203],
4
+ 'e' => [232,233,234,235],
5
+ 'A' => [192,193,194,195,196,197],
6
+ 'a' => [224,225,226,227,228,229,230],
7
+ 'C' => [199],
8
+ 'c' => [231],
9
+ 'O' => [210,211,212,213,214,216],
10
+ 'o' => [242,243,244,245,246,248],
11
+ 'I' => [204,205,206,207],
12
+ 'i' => [236,237,238,239],
13
+ 'U' => [217,218,219,220],
14
+ 'u' => [249,250,251,252],
15
+ 'N' => [209],
16
+ 'n' => [241],
17
+ 'Y' => [221],
18
+ 'y' => [253,255],
19
+ 'AE' => [306],
20
+ 'ae' => [346],
21
+ 'OE' => [188],
22
+ 'oe' => [189]
23
+ }
24
+
25
+ def remove_accents
26
+ str = String.new(self)
27
+ String::ACCENTS_MAPPING.each {|letter,accents|
28
+ packed = accents.pack('U*')
29
+ rxp = Regexp.new("[#{packed}]", nil, 'U')
30
+ str.gsub!(rxp, letter)
31
+ }
32
+
33
+ str
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module Accentless
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe String do
4
+ it "should remove string accents" do
5
+ "São Paulo".remove_accents.should == "Sao Paulo"
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path("lib/accentless.rb")
2
+
3
+ Dir[File.expand_path("spec/support/**/*.rb")].each {|f| require f}
4
+
5
+ RSpec.configure do |config|
6
+ config.mock_with :rspec
7
+ end
8
+
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: accentless
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Lucas Souza
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-05 00:00:00 -03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 2
32
+ - 6
33
+ - 0
34
+ version: 2.6.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: ""
38
+ email:
39
+ - lucasas@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - .rspec
49
+ - .rvmrc
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - README
53
+ - Rakefile
54
+ - accentless.gemspec
55
+ - lib/accentless.rb
56
+ - lib/accentless/extend_string.rb
57
+ - lib/accentless/version.rb
58
+ - spec/accentless/extend_string_spec.rb
59
+ - spec/spec_helper.rb
60
+ has_rdoc: true
61
+ homepage: ""
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project: accentless
90
+ rubygems_version: 1.6.2
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: ""
94
+ test_files: []
95
+