Parent

FriendlyId::SlugGenerator

The default slug generator offers functionality to check slug strings for uniqueness and, if necessary, appends a sequence to guarantee it.

Attributes

normalized[R]
sluggable[R]

Public Class Methods

new(sluggable, normalized) click to toggle source

Create a new slug generator.

# File lib/friendly_id/slug_generator.rb, line 8
def initialize(sluggable, normalized)
  @sluggable  = sluggable
  @normalized = normalized
end

Public Instance Methods

generate() click to toggle source

Generate a new sequenced slug.

# File lib/friendly_id/slug_generator.rb, line 19
def generate
  conflict? ? self.next : normalized
end
next() click to toggle source

Given a slug, get the next available slug in the sequence.

# File lib/friendly_id/slug_generator.rb, line 14
def next
  "#{normalized}#{separator}#{next_in_sequence}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.