libraries 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/libraries.rb +0 -2
- data/lib/libraries/object.rb +1 -2
- data/lib/libraries/string.rb +5 -11
- data/lib/libraries/version.rb +1 -1
- metadata +1 -1
data/lib/libraries.rb
CHANGED
data/lib/libraries/object.rb
CHANGED
data/lib/libraries/string.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
class String
|
2
2
|
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
self.gsub!(/^[#{m}]*(.*?)[#{m}]*$/,'\1')
|
7
|
-
else
|
8
|
-
strip_without_arg_support!
|
9
|
-
end
|
3
|
+
def stripc!(char)
|
4
|
+
m = char.each_char.inject('') {|r,c| r+=(c =~ /[\*\.\[\]\^\$\?\\\|\=\+\:\/\(\)]/ ? "\\" : "") + c}
|
5
|
+
self.gsub!(/^[#{m}]*(.*?)[#{m}]*$/,'\1')
|
10
6
|
end
|
11
|
-
alias_method_chain :strip!, :arg_support
|
12
7
|
|
13
|
-
def
|
14
|
-
|
8
|
+
def stripc(char)
|
9
|
+
self.dup.strip!(char)
|
15
10
|
end
|
16
|
-
alias_method_chain :strip, :arg_support
|
17
11
|
|
18
12
|
# In the sense of normal characters only, it also downcases the string
|
19
13
|
# Can be used, for example, in file names and css classes
|
data/lib/libraries/version.rb
CHANGED