class SlugFu::DefaultNamingStrategy

This strategy tries the original slug first, then appends increasing numbers. The sequence would look like so:

“slug” “slug-1” “slug-2” “slug-3”

Public Class Methods

new(str) click to toggle source
# File lib/slug_fu/default_naming_strategy.rb, line 11
def initialize(str)
  @str = str
  @count = 0
end

Public Instance Methods

next() click to toggle source
# File lib/slug_fu/default_naming_strategy.rb, line 16
def next
  slug = @count > 0 ? "#{@str}-#{@count}" : @str
  @count += 1
  slug
end