Sha256: 7d66b660efaa014f4ad53f93ea23cc7083455a667449503e04993faf8c2f05f7

Contents?: true

Size: 763 Bytes

Versions: 22

Compression:

Stored size: 763 Bytes

Contents

# encoding: utf-8
module FriendlyId

  class SlugString < Babosa::Identifier
    # Normalize the string for a given {FriendlyId::Configuration}.
    # @param config [FriendlyId::Configuration]
    # @return String
    def normalize_for!(config)
      normalize!(config.babosa_options)
    end

    # Validate that the slug string is not blank or reserved, and truncate
    # it to the max length if necessary.
    # @param config [FriendlyId::Configuration]
    # @return String
    # @raise FriendlyId::BlankError
    # @raise FriendlyId::ReservedError
    def validate_for!(config)
      truncate_bytes!(config.max_length)
      raise FriendlyId::BlankError if empty?
      raise FriendlyId::ReservedError if config.reserved?(self)
      self
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
friendly_id-3.3.3.0 lib/friendly_id/slug_string.rb
friendly_id-3.3.2.0 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.6 lib/friendly_id/slug_string.rb
friendly_id-3.3.1.1 lib/friendly_id/slug_string.rb
friendly_id-3.3.1 lib/friendly_id/slug_string.rb
friendly_id-3.3.0.1 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.5 lib/friendly_id/slug_string.rb
friendly_id-4.0.0.beta7 lib/friendly_id/slug_string.rb
friendly_id-3.3.0.rc2 lib/friendly_id/slug_string.rb
friendly_id-3.3.0.rc1 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.4 lib/friendly_id/slug_string.rb
friendly_id-3.3.0.alpha2 lib/friendly_id/slug_string.rb
friendly_id-3.3.0.alpha1 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.3 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.2 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1.1 lib/friendly_id/slug_string.rb
friendly_id-3.2.1.1 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.1 lib/friendly_id/slug_string.rb
friendly_id-3.2.1 lib/friendly_id/slug_string.rb
friendly_id_globalize3-3.2.0 lib/friendly_id/slug_string.rb