All Files
(100.0%
covered at
1.0
hits/line)
1 files in total.
9 relevant lines.
9 lines covered and
0 lines missed
File |
% covered |
Lines |
Relevant Lines |
Lines covered |
Lines missed |
Avg. Hits / Line |
lib/anchorrb.rb |
100.0 % |
13 |
9 |
9 |
0 |
1.0 |
-
# Ruby transcription of:
-
# https://github.com/bryanbraun/anchorjs/blob/master/anchor.js
-
1
class AnchorRb
-
1
def self.convert(rough_text)
-
1
unsafe_chars = %r{[\\\[\]\+\$\?& ,:;=@"{}#|^~`\%!./()*]}
-
1
tidy_text = rough_text.delete("'")
-
1
tidy_text = tidy_text.gsub(unsafe_chars, '-')
-
1
tidy_text = tidy_text.gsub(/-{2,}/, '-')
-
1
tidy_text = tidy_text[0, 64]
-
1
tidy_text = tidy_text.gsub(/^-+|-+$/, '')
-
1
tidy_text.downcase
-
end
-
end