Class: RedQuilt::Slug::Counter
- Inherits:
-
Object
- Object
- RedQuilt::Slug::Counter
- Defined in:
- lib/red_quilt/slug.rb
Overview
Deduplicates slugs within a single document: the first occurrence of a base keeps it, later collisions get ‘-1`, `-2`, … suffixes (matching GitHub’s anchor numbering).
Instance Method Summary collapse
- #generate(text) ⇒ Object
-
#initialize ⇒ Counter
constructor
A new instance of Counter.
Constructor Details
#initialize ⇒ Counter
Returns a new instance of Counter.
26 27 28 |
# File 'lib/red_quilt/slug.rb', line 26 def initialize @seen = Hash.new(0) end |