accent-buster 0.9.0 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 214f07f5f855a7d49353df174683ab1afbe9e091
4
- data.tar.gz: ec6bff259e39b7e1dd148d8a5b1bf0e00f683dec
3
+ metadata.gz: 92de494461848c93cbc4edb566f1628665631af7
4
+ data.tar.gz: 4fa2724528fb23df070692969f5a2337d46cce59
5
5
  SHA512:
6
- metadata.gz: c0bf03753095dc90a913b2671a06b211107951993d6ea372360a8274478cb55e943efd8c7f0880e0d9b5173c328ecc8a822a2060e6721313f15d337cf7078ce8
7
- data.tar.gz: 6d41c3826b513904a5cb8a00c6be29fa03ed72bf5d2bd92fbd77601d88efecd1c34a9125acdbaa3e50ebbc414b8e6c5cb1fc486058a34bc7622a3c9a19b40518
6
+ metadata.gz: 8e93e149c1d9009f153997b06ef6fc8d6fed01594040445bdbd65af66231a2c27eb587625b40c3ce72ce79c805fe91e596dd1becebff4b3f5370fec6c3bbcc6e
7
+ data.tar.gz: f1692695e4d56162e4f88fae5df06d6f8460a434289e7c28517896467f58617ea4ebcd653f5fa308a6b675146e05f6af8a446bba3b58fb85a3961e9545c60061
data/README.md CHANGED
@@ -6,6 +6,8 @@ I made it because I don't want to add "ActiveSupport" to the projects everytime
6
6
 
7
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
8
 
9
+ Accent Buster uses refinements, so, ruby 2.0+ only.
10
+
9
11
  ## Installation
10
12
 
11
13
  Add this line to your application's Gemfile:
@@ -22,12 +24,15 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- !!!ruby
26
- 'ação'.accent\_buster # => 'acao'
27
- x = 'é você?'
28
- x.accent\_buster!
29
- # => x = 'e voce'
30
- !!!
27
+ ```ruby
28
+ # Refinements!
29
+ using AccentBuster::StringExtension
30
+
31
+ 'ação'.accent_buster # => 'acao'
32
+ x = 'é você?'
33
+ x.accent_buster!
34
+ # => x = 'e voce'
35
+ ```
31
36
 
32
37
  ## Contributing
33
38
 
@@ -4,6 +4,9 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'accent-buster/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
+ # We are using refinements
8
+ spec.required_ruby_version = '>= 2.0'
9
+
7
10
  spec.name = "accent-buster"
8
11
  spec.version = AccentBuster::VERSION
9
12
  spec.authors = ["Ronie Uliana"]
@@ -1,2 +1,5 @@
1
1
  require 'accent-buster/version'
2
2
  require 'accent-buster/string_extension'
3
+
4
+ module AccentBuster
5
+ end
@@ -1,21 +1,23 @@
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
1
+ module AccentBuster::StringExtension
2
+ refine String do
3
+ # Convert diacritics chars to their non-diacritic equivalents.
4
+ #
5
+ # Works for latin languages only.
6
+ #
7
+ # Returns a copy of the string with diacritics removed.
8
+ def accent_buster
9
+ self.tr('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC')
10
+ end
10
11
 
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')
12
+ # Convert diacritics chars to their non-diacritic equivalents.
13
+ #
14
+ # Works for latin languages only.
15
+ #
16
+ # Convert the string in place.
17
+ #
18
+ # Returns the string or nil if no changes were made.
19
+ def accent_buster!
20
+ self.tr!('áéíóúâêîôûäëïöüãõñçÁÉÍÓÚÂÊÎÔÛÄËÏÖÜÃÕÑÇ', 'aeiouaeiouaeiouaoncAEIOUAEIOUAEIOUAONC')
21
+ end
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module AccentBuster
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accent-buster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronie Uliana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-27 00:00:00.000000000 Z
11
+ date: 2013-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Add "String#accent_buster" that replaces diacritics marks by their non-diacritic
@@ -46,7 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - .gitignore
49
+ - ".gitignore"
50
50
  - Gemfile
51
51
  - LICENSE
52
52
  - README.md
@@ -65,17 +65,17 @@ require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: '2.0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.1.11
78
+ rubygems_version: 2.2.0
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: 'Add "String#accent_buster" that replaces diacritics marks by their non-diacritic