string_case_pl 0.0.3 → 0.0.4

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.
@@ -13,6 +13,7 @@ class String
13
13
 
14
14
  alias old_downcase_wo_pl downcase
15
15
  alias old_upcase_wo_pl upcase
16
+ alias old_capitalize_wo_pl capitalize
16
17
 
17
18
  def downcase
18
19
  case self.encoding.name
@@ -39,15 +40,17 @@ class String
39
40
  end
40
41
 
41
42
  def capitalize
42
- self[0] = case self.encoding.name
43
- when "UTF-8"
44
- self[0].tr(PL_UTF_8_LOWER, PL_UTF_8_UPPER)
45
- when "ISO-8859-2"
46
- self[0].tr(PL_ISO_8859_2_LOWER, PL_ISO_8859_2_UPPER)
47
- when "Windows-1250"
48
- self[0].tr(PL_WINDOWS_1250_LOWER, PL_WINDOWS_1250_UPPER)
49
- end
50
- self
43
+ s = self.dup
44
+ s[0] = s[0].upcase
45
+ s[1..-1] = s[1..-1].downcase
46
+ s
47
+ end
48
+
49
+ def capitalize!
50
+ old = self.dup
51
+ self[0] = self[0].upcase
52
+ self[1..-1] = self[1..-1].downcase
53
+ self unless old == self
51
54
  end
52
55
 
53
56
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "string_case_pl"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.date = "2009-12-27"
5
5
  s.summary = "Additional support for Polish encodings in Ruby 1.9"
6
6
  s.email = "apohllo@o2.pl"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aleksander Pohl