<commit_before># agnostic_slugs

agnostic_slugs is a simple slug generator that is agnostic.

What it can:
* Generate slugs

What it can not:
* Integrate with ActiveRecord, Mongoid or any other ORM
* Integrate with Rails or any other framework
* Monkey-patch the `String` class

## Status

[![Build Status](https://semaphoreci.com/api/v1/projects/0be3abb2-794f-4513-a121-220b1278f853/313941/badge.svg)](https://semaphoreci.com/lasseebert/agnostic_slugs)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'agnostic_slugs'
```

## Usage

```ruby
slug = AgnosticSlugs::Slug.new('Look at my pretty new shoes! :)')
slug.to_s       # => "look-at-my-pretty-new-shoes"
slug.next.to_s  # => "look-at-my-pretty-new-shoes-2"
```

Or step through slugs to find a unique slug using your own business logic:

```ruby
AgnosticSlugs::Slug.step('Hello world') do |slug|
  my_repo.slug_unique?(slug)
end
# => "hello-world-7"
```


## Contributing

1. Fork it ( https://github.com/lasseebert/agnostic_slugs/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)<commit_msg>README: Usage<commit_after># agnostic_slugs

agnostic_slugs is a simple slug generator that is agnostic.

What it can:
* Generate slugs

What it can not:
* Integrate with ActiveRecord, Mongoid or any other ORM
* Integrate with Rails or any other framework
* Monkey-patch the `String` class

## Status

[![Build Status](https://semaphoreci.com/api/v1/projects/0be3abb2-794f-4513-a121-220b1278f853/313941/badge.svg)](https://semaphoreci.com/lasseebert/agnostic_slugs)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'agnostic_slugs'
```

## Usage

It makes a slug suitable for URLs:

```ruby
slug = AgnosticSlugs::Slug.new("Look at my pretty new shoes! :)")
slug.to_s # => "look-at-my-pretty-new-shoes"
```

It expands foreign chars. Example in Danish:

```ruby
slug = AgnosticSlugs::Slug.new("Ræven spiser rønnebær")
slug.to_s # => "raeven-spiser-roennebaer"
```

Find `#next` slug:

```ruby
slug = AgnosticSlugs::Slug.new("Hello")
slug.to_s       # => "hello"
slug.next.to_s  # => "hello-2"
```

Or `.step` through slugs to find a unique slug using your own business logic:

```ruby
AgnosticSlugs::Slug.step("Hello world") do |slug|
  my_repo.slug_unique?(slug)
end
# => "hello-world-7"
```


## Contributing

1. Fork it ( https://github.com/lasseebert/agnostic_slugs/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
{'fraction_non_alphanumeric': 0.14042207792207792, 'fraction_numerical': 0.027597402597402596, 'mean_word_length': 4.5895691609977325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6971017', 'n_tokens_mistral': 983, 'n_tokens_neox': 923, 'n_words': 233}