anchors 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anchors.rb +8 -1
- data/lib/anchors/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 398ea7821db1532928334d44f8eb5075589c070d
|
4
|
+
data.tar.gz: 351f92ccb41311a7e2b1bf54e98585ab2f1d0f7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6eabbc2b80afb830db8b0d9df2944bdfaed9e29661aa7c0c528dd468739ef5b3b62113e9220e7911a1e0312b2dd48338d3f187278a34015076c66d7af134c6
|
7
|
+
data.tar.gz: d33392adafb8e31ed2b4768849d0f5c47aa9a40ebb36406f42e4e8076944a6fd9c61784e828b5e8f064e95b3e840c065496499e9e0adfadaded7a3cca37a994f
|
data/lib/anchors.rb
CHANGED
@@ -40,7 +40,14 @@ module Anchors
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def dom_id(el)
|
43
|
-
el.content.downcase.gsub(/[^\d\w\s_]/, '').gsub(' ',
|
43
|
+
id = el.content.downcase.gsub(/[^\d\w\s_]/, '').gsub(' ', seperator)
|
44
|
+
[id, id_count(id)].compact.join(seperator)
|
45
|
+
end
|
46
|
+
|
47
|
+
def id_count(id)
|
48
|
+
@id_counts ||= Hash.new{ |h,k| h[k] = 0 }
|
49
|
+
@id_counts[id] += 1
|
50
|
+
@id_counts[id] if @id_counts[id] > 1
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|
data/lib/anchors/version.rb
CHANGED