ruby-nuggets 0.0.9.209 → 0.1.0.210
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/nuggets/string/capitalize_first.rb +62 -0
- data/lib/nuggets/version.rb +2 -2
- metadata +3 -2
data/README
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of ruby-nuggets, some extensions to the Ruby programming #
|
5
|
+
# language. #
|
6
|
+
# #
|
7
|
+
# Copyright (C) 2007-2008 Jens Wille #
|
8
|
+
# #
|
9
|
+
# Authors: #
|
10
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
11
|
+
# #
|
12
|
+
# ruby-nuggets is free software; you can redistribute it and/or modify it #
|
13
|
+
# under the terms of the GNU General Public License as published by the Free #
|
14
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
15
|
+
# any later version. #
|
16
|
+
# #
|
17
|
+
# ruby-nuggets is distributed in the hope that it will be useful, but WITHOUT #
|
18
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
20
|
+
# more details. #
|
21
|
+
# #
|
22
|
+
# You should have received a copy of the GNU General Public License along #
|
23
|
+
# with ruby-nuggets. If not, see <http://www.gnu.org/licenses/>. #
|
24
|
+
# #
|
25
|
+
###############################################################################
|
26
|
+
#++
|
27
|
+
|
28
|
+
class String
|
29
|
+
|
30
|
+
# call-seq:
|
31
|
+
# str.capitalize_first => new_string
|
32
|
+
#
|
33
|
+
# Capitalizes the first character in +str+, but without downcasing the rest
|
34
|
+
# like String#capitalize does.
|
35
|
+
def capitalize_first
|
36
|
+
self[0..0].upcase << self[1..-1]
|
37
|
+
end
|
38
|
+
|
39
|
+
# call-seq:
|
40
|
+
# str.capitalize_first! => str
|
41
|
+
#
|
42
|
+
# Destructive version of #capitalize_first.
|
43
|
+
def capitalize_first!
|
44
|
+
replace capitalize_first
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
if $0 == __FILE__
|
50
|
+
s = 'Some string'
|
51
|
+
p s
|
52
|
+
p s.capitalize_first
|
53
|
+
|
54
|
+
s = 'some string'
|
55
|
+
p s
|
56
|
+
p s.capitalize_first
|
57
|
+
|
58
|
+
s = 'SOME STRING'
|
59
|
+
p s
|
60
|
+
p s.capitalize
|
61
|
+
p s.capitalize_first
|
62
|
+
end
|
data/lib/nuggets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-nuggets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.210
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-20 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/nuggets/string/evaluate.rb
|
36
36
|
- lib/nuggets/string/word_wrap.rb
|
37
37
|
- lib/nuggets/string/nsub.rb
|
38
|
+
- lib/nuggets/string/capitalize_first.rb
|
38
39
|
- lib/nuggets/hash/in_order.rb
|
39
40
|
- lib/nuggets/hash/insert.rb
|
40
41
|
- lib/nuggets/proc/bind.rb
|