useful_class_extensions 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/useful_class_extensions.rb +5 -5
- metadata +1 -1
@@ -154,19 +154,19 @@ class String
|
|
154
154
|
return self.gsub(/[\'\"]/, '').gsub("#", "%23").gsub(' ', '%20')
|
155
155
|
end
|
156
156
|
|
157
|
-
def
|
157
|
+
def classify_homebrew
|
158
158
|
if self.split(//).last == "s"
|
159
159
|
if self.split(//)[self.split(//).length-3..self.split(//).length].join == "ies"
|
160
|
-
|
160
|
+
camelize_homebrew(self.split(//)[0..self.split(//).length-4].join("")+"y")
|
161
161
|
else
|
162
|
-
|
162
|
+
camelize_homebrew(self.sub(/.*\./, '').chop)
|
163
163
|
end
|
164
164
|
else
|
165
|
-
|
165
|
+
camelize_homebrew(self.sub(/.*\./, ''))
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
def
|
169
|
+
def camelize_homebrew(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
170
170
|
if first_letter_in_uppercase
|
171
171
|
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
172
172
|
end
|