string_case_pl 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ .DS_Store
3
+ .*.sw?
data/README.rdoc ADDED
@@ -0,0 +1,57 @@
1
+ == String Case/Comparison of Polish strings
2
+
3
+ Due to the fact, that case conversion and string comparison
4
+ is encoding and locale dependent, in Ruby 1.9 the default
5
+ implementation of String#upcase, String#downcase and String#<=>
6
+ doesn't work properly for languages other than English.
7
+
8
+ This library brings the implementation of #upcase, #downcase, #capitalize
9
+ and #<=> which accords with the Polish grammar rules.
10
+
11
+ == INSTALL
12
+
13
+ gem install string_case_pl
14
+
15
+ == USAGE
16
+
17
+ If you want only #upcase #downcase and #capitalize to work properly
18
+ require the following file:
19
+
20
+ require 'string_case_pl'
21
+
22
+ If you also want #<=> to work properly, require the following file:
23
+
24
+ require 'string_cmp_pl'
25
+
26
+ It implicitly requires the 'string_case_pl'. This is split into two
27
+ file, since reimplementation of <=> for string might cause a serious
28
+ performance hit.
29
+
30
+ == LICENSE
31
+
32
+ (The MIT/X11 License)
33
+
34
+ Copyright (c) 2008-2011 Aleksander Pohl
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining
37
+ a copy of this software and associated documentation files (the
38
+ 'Software'), to deal in the Software without restriction, including
39
+ without limitation the rights to use, copy, modify, merge, publish,
40
+ distribute, sublicense, and/or sell copies of the Software, and to
41
+ permit persons to whom the Software is furnished to do so, subject to
42
+ the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be
45
+ included in all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
48
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
50
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
51
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
52
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
53
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54
+
55
+ == FEEDBACK
56
+
57
+ * mailto:apohllo@o2.pl
data/changelog.txt ADDED
@@ -0,0 +1,23 @@
1
+ 0.1.2
2
+ - fix capitalization of an empty string
3
+ 0.1.1
4
+ - fix upcase and downcase modifying string in place
5
+ - upcase!, downcase! added
6
+ - encoding names are constants
7
+ 0.1.0
8
+ - readme
9
+ - comparison of Polish strings
10
+ - constantize encoding names
11
+ - removal of empty spaces
12
+ - update date and authors
13
+ 0.0.5
14
+ - added #capitalize!
15
+ 0.0.4
16
+ - added #capitalize
17
+ 0.0.2
18
+ - changed the name of the gem
19
+ - removed backup files
20
+ - added tests and windows-1250 support
21
+ - locale_pl changed into string_pl
22
+ - Tests removed form Rakefile and gemspec
23
+ - Initial commit of locale_pl
@@ -56,8 +56,8 @@ class String
56
56
 
57
57
  def capitalize
58
58
  s = self.dup
59
- s[0] = s[0].upcase
60
- s[1..-1] = s[1..-1].downcase
59
+ s[0..0] = s[0..0].upcase
60
+ s[1..-1] = s[1..-1].downcase if s[1]
61
61
  s
62
62
  end
63
63
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "string_case_pl"
3
- s.version = "0.1.1"
4
- s.date = "2011-08-02"
3
+ s.version = "0.1.2"
4
+ s.date = "#{Time.now.strftime("%Y-%m-%d")}"
5
5
  s.required_ruby_version = '>= 1.9.2'
6
6
  s.summary = "Additional support for Polish encodings in Ruby 1.9"
7
7
  s.email = "apohllo@o2.pl"
@@ -9,9 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.description = "Polish extensions for Ruby 1.9 String #upcase(!), #downcase(!), #capitalize(!) and #<=> supporting polish diacritics"
10
10
  s.require_path = "lib"
11
11
  s.authors = ['Aleksander Pohl',"hosiawak","sebcioz"]
12
- s.files = ["Rakefile", "string_case_pl.gemspec", 'lib/string_case_pl.rb'] +
13
- Dir.glob("lib/**/*")
14
- s.test_files = Dir.glob("{test}/**/*")
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
15
14
  #s.rdoc_options = ["--main", "README.txt"]
16
15
  #s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
17
16
  end
@@ -146,4 +146,22 @@ class TestCharacterCaseChange < Test::Unit::TestCase
146
146
  assert_equal(copy.capitalize!, nil)
147
147
  end
148
148
 
149
+ def test_empty_string_capitalize
150
+ empty_string = ""
151
+ empty_string_copy = empty_string.dup
152
+ assert_equal(empty_string_copy,empty_string.capitalize)
153
+ end
154
+
155
+ def test_empty_string_capitalize!
156
+ empty_string = ""
157
+ empty_string.capitalize!
158
+ assert_equal(empty_string,"")
159
+ end
160
+
161
+ def test_one_letter_capitalize
162
+ one_letter = "ą"
163
+ assert_equal(one_letter.capitalize,"Ą")
164
+ one_letter = "Ą"
165
+ assert_equal(one_letter.capitalize,"Ą")
166
+ end
149
167
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: string_case_pl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Aleksander Pohl
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-08-02 00:00:00 Z
15
+ date: 2012-02-27 00:00:00 Z
16
16
  dependencies: []
17
17
 
18
18
  description: "Polish extensions for Ruby 1.9 String #upcase(!), #downcase(!), #capitalize(!) and #<=> supporting polish diacritics"
@@ -24,12 +24,15 @@ extensions: []
24
24
  extra_rdoc_files: []
25
25
 
26
26
  files:
27
+ - .gitignore
28
+ - README.rdoc
27
29
  - Rakefile
28
- - string_case_pl.gemspec
30
+ - changelog.txt
29
31
  - lib/string_case_pl.rb
30
32
  - lib/string_cmp_pl.rb
31
- - test/test_comparison.rb
33
+ - string_case_pl.gemspec
32
34
  - test/test_character_case_change.rb
35
+ - test/test_comparison.rb
33
36
  - test/test_helper.rb
34
37
  homepage: https://github.com/apohllo/string_pl
35
38
  licenses: []
@@ -58,7 +61,5 @@ rubygems_version: 1.8.5
58
61
  signing_key:
59
62
  specification_version: 3
60
63
  summary: Additional support for Polish encodings in Ruby 1.9
61
- test_files:
62
- - test/test_comparison.rb
63
- - test/test_character_case_change.rb
64
- - test/test_helper.rb
64
+ test_files: []
65
+