Class: FriendlyId::SlugString

Inherits:
Babosa::Identifier
  • Object
show all
Defined in:
lib/friendly_id/slug_string.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) normalize_for!(config)

Normalize the string for a given Configuration.

Parameters:

Returns:

  • String



8
9
10
# File 'lib/friendly_id/slug_string.rb', line 8

def normalize_for!(config)
  normalize!(config.babosa_options)
end

- (Object) validate_for!(config)

Validate that the slug string is not blank or reserved, and truncate it to the max length if necessary.

Parameters:

Returns:

  • String

Raises:

  • FriendlyId::BlankError

  • FriendlyId::ReservedError



18
19
20
21
22
23
# File 'lib/friendly_id/slug_string.rb', line 18

def validate_for!(config)
  truncate_bytes!(config.max_length)
  raise FriendlyId::BlankError if empty?
  raise FriendlyId::ReservedError if config.reserved?(self)
  self
end