push
travis-ci
99 of 99 new or added lines in 8 files covered. (100.0%)
208 of 261 relevant lines covered (79.69%)
550.0 hits per line
1 |
class Wasabi |
|
2 |
module CoreExt |
|
3 |
module String |
|
4 |
|
|
5 |
# Returns the String in snakecase.
|
|
6 |
def snakecase |
× |
7 |
str = dup |
3,091✔ |
8 |
str.gsub! /::/, '/' |
3,091✔ |
9 |
str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2' |
3,091✔ |
10 |
str.gsub! /([a-z\d])([A-Z])/, '\1_\2' |
3,091✔ |
11 |
str.tr! ".", "_" |
3,091✔ |
12 |
str.tr! "-", "_" |
3,091✔ |
13 |
str.downcase! |
3,091✔ |
14 |
str |
3,091✔ |
15 |
end unless method_defined?(:snakecase) |
|
16 |
|
|
17 |
end
|
|
18 |
end
|
|
19 |
end
|
|
20 |
|
|
21 |
String.send :include, Wasabi::CoreExt::String |