libraries 0.1.5 → 0.1.6
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/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