backports 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/backports/string.rb +8 -8
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/backports/string.rb
CHANGED
@@ -45,8 +45,8 @@ class String
|
|
45
45
|
end unless method_defined? :codepoints
|
46
46
|
|
47
47
|
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
|
48
|
-
def constantize
|
49
|
-
names =
|
48
|
+
def constantize
|
49
|
+
names = split('::')
|
50
50
|
names.shift if names.empty? || names.first.empty?
|
51
51
|
|
52
52
|
constant = Object
|
@@ -57,13 +57,13 @@ class String
|
|
57
57
|
end unless method_defined? :constantize
|
58
58
|
|
59
59
|
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
|
60
|
-
def dasherize
|
61
|
-
|
60
|
+
def dasherize
|
61
|
+
gsub(/_/, '-')
|
62
62
|
end unless method_defined? :dasherize
|
63
63
|
|
64
64
|
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
|
65
|
-
def demodulize
|
66
|
-
|
65
|
+
def demodulize
|
66
|
+
gsub(/^.*::/, '')
|
67
67
|
end unless method_defined? :demodulize
|
68
68
|
|
69
69
|
make_block_optional :each_byte, :each, :each_line, :test_on => "abc"
|
@@ -147,8 +147,8 @@ class String
|
|
147
147
|
end unless method_defined? :start_with?
|
148
148
|
|
149
149
|
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
|
150
|
-
def underscore
|
151
|
-
|
150
|
+
def underscore
|
151
|
+
gsub(/::/, '/').
|
152
152
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
153
153
|
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
154
154
|
tr("-", "_").
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marc-Andr\xC3\xA9 Lafortune"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-01 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|