accent-buster 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 214f07f5f855a7d49353df174683ab1afbe9e091
4
+ data.tar.gz: ec6bff259e39b7e1dd148d8a5b1bf0e00f683dec
5
+ SHA512:
6
+ metadata.gz: c0bf03753095dc90a913b2671a06b211107951993d6ea372360a8274478cb55e943efd8c7f0880e0d9b5173c328ecc8a822a2060e6721313f15d337cf7078ce8
7
+ data.tar.gz: 6d41c3826b513904a5cb8a00c6be29fa03ed72bf5d2bd92fbd77601d88efecd1c34a9125acdbaa3e50ebbc414b8e6c5cb1fc486058a34bc7622a3c9a19b40518
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in accent_buster.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Ronie Uliana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Accent Buster
2
+
3
+ Add "String#accent\_buster" that replaces diacritics marks by their non-diacritic equivalents.
4
+
5
+ I made it because I don't want to add "ActiveSupport" to the projects everytime I need that (also, I'm too lazy to type the same thing all the time).
6
+
7
+ This lib will have NO MORE than the very strictly necessary to replace diacritics, currently, it has 2 methods: "String#accent_buster" and "String#accent_buster!" (note the bang).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'accent-buster'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install accent-buster
22
+
23
+ ## Usage
24
+
25
+ !!!ruby
26
+ 'ação'.accent\_buster # => 'acao'
27
+ x = 'é você?'
28
+ x.accent\_buster!
29
+ # => x = 'e voce'
30
+ !!!
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'accent-buster/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "accent-buster"
8
+ spec.version = AccentBuster::VERSION
9
+ spec.authors = ["Ronie Uliana"]
10
+ spec.email = ["ronie.uliana@gmail.com"]
11
+ spec.description = %q{Add "String#accent_buster" that replaces diacritics marks by their non-diacritic equivalents.}
12
+ spec.summary = %q{Add "String#accent_buster" that replaces diacritics marks by their non-diacritic equivalents. I made it because I don't want to add "ActiveSupport" to the projects everytime I need that (also, I'm too lazy to type the same thing all the time). This lib will have NO MORE than the very strictly necessary to replace diacritics, currently, it has 2 methods: "String#accent_buster" and "String#accent_buster!" (note the bang).}
13
+ spec.homepage = "http://github.com/ruliana/accent-buster"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,2 @@
1
+ require 'accent-buster/version'
2
+ require 'accent-buster/string_extension'
@@ -0,0 +1,21 @@
1
+ class String
2
+ # Convert diacritics chars to their non-diacritic equivalents.
3
+ #
4
+ # Works for latin languages only.
5
+ #
6
+ # Returns a copy of the string with diacritics removed.
7
+ def accent_buster
8
+ self.tr('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC')
9
+ end
10
+
11
+ # Convert diacritics chars to their non-diacritic equivalents.
12
+ #
13
+ # Works for latin languages only.
14
+ #
15
+ # Convert the string in place.
16
+ #
17
+ # Returns the string or nil if no changes were made.
18
+ def accent_buster!
19
+ self.tr!('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC')
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module AccentBuster
2
+ VERSION = "0.9.0"
3
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: accent-buster
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Ronie Uliana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Add "String#accent_buster" that replaces diacritics marks by their non-diacritic
42
+ equivalents.
43
+ email:
44
+ - ronie.uliana@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - accent-buster.gemspec
55
+ - lib/accent-buster.rb
56
+ - lib/accent-buster/string_extension.rb
57
+ - lib/accent-buster/version.rb
58
+ homepage: http://github.com/ruliana/accent-buster
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.1.11
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: 'Add "String#accent_buster" that replaces diacritics marks by their non-diacritic
82
+ equivalents. I made it because I don''t want to add "ActiveSupport" to the projects
83
+ everytime I need that (also, I''m too lazy to type the same thing all the time).
84
+ This lib will have NO MORE than the very strictly necessary to replace diacritics,
85
+ currently, it has 2 methods: "String#accent_buster" and "String#accent_buster!"
86
+ (note the bang).'
87
+ test_files: []