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.
- data/lib/string_case_pl.rb +12 -9
- data/string_case_pl.gemspec +1 -1
- metadata +2 -2
data/lib/string_case_pl.rb
CHANGED
@@ -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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
data/string_case_pl.gemspec
CHANGED