greek_string_utils 0.0.4 → 0.0.5
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.
- data/.gitignore +2 -0
- data/Gemfile +1 -3
- data/{README.rdoc → README.md} +24 -7
- data/Rakefile +0 -4
- data/greek_string_utils.gemspec +2 -0
- data/lib/greek_string_utils.rb +6 -6
- data/lib/greek_string_utils/version.rb +1 -1
- data/spec/greek_string_utils_spec.rb +6 -1
- metadata +21 -14
- data/Gemfile.lock +0 -24
- data/MIT-LICENSE +0 -20
- data/lib/tasks/greek_upperfix_tasks.rake +0 -4
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/{README.rdoc → README.md}
RENAMED
@@ -1,6 +1,11 @@
|
|
1
|
-
|
1
|
+
# GreekStringUtils
|
2
2
|
|
3
|
-
|
3
|
+
## Note
|
4
|
+
|
5
|
+
This project is a subset of a larger private repo. I hope that it will become
|
6
|
+
public soon.
|
7
|
+
|
8
|
+
## Description
|
4
9
|
|
5
10
|
This module simply provides some methods to handle issues with greek letters
|
6
11
|
|
@@ -11,12 +16,15 @@ This module simply provides some methods to handle issues with greek letters
|
|
11
16
|
For other cases (capitalize, downcase etc) +unicode+, +mb_chars+ etc are doing
|
12
17
|
their job very well.
|
13
18
|
|
14
|
-
|
19
|
+
## Install
|
15
20
|
|
16
|
-
|
21
|
+
```ruby
|
22
|
+
gem install 'greek_string_utils'
|
23
|
+
```
|
17
24
|
|
18
|
-
|
25
|
+
## Usage
|
19
26
|
|
27
|
+
```ruby
|
20
28
|
require 'greek_string_utils'
|
21
29
|
include GreekStringUtils
|
22
30
|
|
@@ -28,15 +36,24 @@ gem install 'greek_string_utils'
|
|
28
36
|
|
29
37
|
a = 'κρύο'
|
30
38
|
remove_accents(a) # => 'κρυο'
|
39
|
+
```
|
31
40
|
|
32
41
|
if you want to use it in a rails app:
|
33
42
|
|
43
|
+
```ruby
|
34
44
|
gem 'greek_string_utils'
|
35
|
-
|
45
|
+
```
|
36
46
|
And normally in application_helper.rb:
|
37
47
|
|
48
|
+
```ruby
|
38
49
|
include GreekStringUtils
|
50
|
+
```
|
39
51
|
|
40
|
-
|
52
|
+
## Credits
|
41
53
|
|
42
54
|
Eric Cohen https://github.com/eirc
|
55
|
+
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
greek_string_utils is released under the [MIT License](http://opensource.org/licenses/MIT)
|
data/Rakefile
CHANGED
data/greek_string_utils.gemspec
CHANGED
data/lib/greek_string_utils.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#require 'pry'
|
1
|
+
# coding: utf-8
|
3
2
|
|
4
3
|
module GreekStringUtils
|
5
4
|
def upperfix(string)
|
6
|
-
string.chars.map do |char|
|
5
|
+
string.to_s.chars.map do |char|
|
7
6
|
case char
|
8
7
|
# Downcase characters
|
9
8
|
when 'α' then 'Α'
|
@@ -34,7 +33,8 @@ module GreekStringUtils
|
|
34
33
|
# Downcase characters with acute accents
|
35
34
|
when 'ά' then 'Α'
|
36
35
|
when 'έ' then 'Ε'
|
37
|
-
when 'ή'
|
36
|
+
when 'ή'
|
37
|
+
string.to_s.size > 1 ? 'H' : 'Ή'
|
38
38
|
when 'ί' then 'Ι'
|
39
39
|
when 'ό' then 'Ο'
|
40
40
|
when 'ύ' then 'Υ'
|
@@ -59,7 +59,7 @@ module GreekStringUtils
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def remove_accents(string)
|
62
|
-
string.chars.map do |char|
|
62
|
+
string.to_s.chars.map do |char|
|
63
63
|
case char
|
64
64
|
when 'ά' then 'α'
|
65
65
|
when 'έ' then 'ε'
|
@@ -86,7 +86,7 @@ module GreekStringUtils
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def has_accent?(string)
|
89
|
-
string.match(/ά|έ|ή|ί|ό|ύ|ώ|Ά|Έ|Ή|Ί|Ϊ|Ό|Ύ|Ώ|ϊ|ϋ|ΐ|ΰ/) ? true : false
|
89
|
+
string.to_s.match(/ά|έ|ή|ί|ό|ύ|ώ|Ά|Έ|Ή|Ί|Ϊ|Ό|Ύ|Ώ|ϊ|ϋ|ΐ|ΰ/) ? true : false
|
90
90
|
end
|
91
91
|
|
92
92
|
def greek_sort(array)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
2
|
|
3
3
|
require 'greek_string_utils'
|
4
4
|
|
@@ -46,4 +46,9 @@ describe 'GreekStringUtils' do
|
|
46
46
|
greek_sort(a).should eql(%w(α αβ άβας))
|
47
47
|
end
|
48
48
|
|
49
|
+
it 'should keep ή in upcase as Ή' do
|
50
|
+
a = 'ή'
|
51
|
+
upperfix(a).should eql('Ή')
|
52
|
+
end
|
53
|
+
|
49
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greek_string_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
12
|
+
date: 2014-01-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
description: Simple library to correct upcase in greek
|
15
31
|
email:
|
16
32
|
- giorgos.tsiftsis@gmail.com
|
@@ -21,14 +37,11 @@ files:
|
|
21
37
|
- .gitignore
|
22
38
|
- .rspec
|
23
39
|
- Gemfile
|
24
|
-
-
|
25
|
-
- MIT-LICENSE
|
26
|
-
- README.rdoc
|
40
|
+
- README.md
|
27
41
|
- Rakefile
|
28
42
|
- greek_string_utils.gemspec
|
29
43
|
- lib/greek_string_utils.rb
|
30
44
|
- lib/greek_string_utils/version.rb
|
31
|
-
- lib/tasks/greek_upperfix_tasks.rake
|
32
45
|
- spec/greek_string_utils_spec.rb
|
33
46
|
homepage: https://github.com/chief/greek_string_utils
|
34
47
|
licenses: []
|
@@ -42,21 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
55
|
- - ! '>='
|
43
56
|
- !ruby/object:Gem::Version
|
44
57
|
version: '0'
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
hash: -178008917700154382
|
48
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
59
|
none: false
|
50
60
|
requirements:
|
51
61
|
- - ! '>='
|
52
62
|
- !ruby/object:Gem::Version
|
53
63
|
version: '0'
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
hash: -178008917700154382
|
57
64
|
requirements: []
|
58
65
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.8.
|
66
|
+
rubygems_version: 1.8.23
|
60
67
|
signing_key:
|
61
68
|
specification_version: 3
|
62
69
|
summary: Simple library to correct upcase in greek
|
data/Gemfile.lock
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
greek_string_utils (0.0.4)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.1.3)
|
10
|
-
rspec (2.6.0)
|
11
|
-
rspec-core (~> 2.6.0)
|
12
|
-
rspec-expectations (~> 2.6.0)
|
13
|
-
rspec-mocks (~> 2.6.0)
|
14
|
-
rspec-core (2.6.4)
|
15
|
-
rspec-expectations (2.6.0)
|
16
|
-
diff-lcs (~> 1.1.2)
|
17
|
-
rspec-mocks (2.6.0)
|
18
|
-
|
19
|
-
PLATFORMS
|
20
|
-
ruby
|
21
|
-
|
22
|
-
DEPENDENCIES
|
23
|
-
greek_string_utils!
|
24
|
-
rspec
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2012 YOURNAME
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|