Complexity Score
Low
Open Issues
N/A
Dependent Projects
3
Weekly Downloadsglobal
77
License
- MIT
- Yesattribution
- Permissivelinking
- Permissivedistribution
- Permissivemodification
- Nopatent grant
- Yesprivate use
- Permissivesublicensing
- Notrademark grant
Downloads
Readme
ToSlugParam
Convert strings and symbols to slug param
Transliteration + Parameterization for slugs building
Install
gem "to_slug_param", "~> 1.2"
RubyGems/to_slug_param
Using
For russian transliteration by default
I18n.enforce_available_locales = true
module DummyApp
class Application < Rails::Application
config.i18n.default_locale = :ru
end
end
"Привет Мир! Hello world!".to_slug_param
# => "privet-mir-hello-world"
String.to_slug_param("Привет Мир! Hello world!")
# => "privet-mir-hello-world"
Be carefully with file extension
"Документ.doc".to_slug_param
# => "dokument-doc"
For filenames:
"/доки/dir/тест/документ.doc".slugged_filename #=> "dokument.doc"
String.slugged_filename("/доки/dir/тест/документ.doc") #=> "dokument.doc"
For full file path:
"/доки/dir/тест/документ.doc".slugged_filepath #=> "/доки/dir/тест/dokument.doc"
String.slugged_filepath("/доки/dir/тест/документ.doc") #=> "/доки/dir/тест/dokument.doc"
Params
"Документ.doc".to_slug_param(locale: :ru) # => "dokument-doc"
"Документ.doc".to_slug_param(locale: :en) # => "doc"
"Документ.doc".to_slug_param(sep: '_', locale: :ru) # => "dokument_doc"
"Документ.doc".to_slug_param(sep: '_', locale: :en) # => "doc"
HOW TO TEST
TODO: https://github.com/TheRole/the_role_dev
MIT-LICENSE
Copyright (c) 2013-2023 [Ilya N.Zykin]
MIT BASED LICENSE
Dependencies
CVE IssuesActive
0
Scorecards Score
No Data
Test Coverage
No Data
Follows Semver
No
Github Stars
20
Dependenciestotal
3
DependenciesOutdated
1
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No
Learn how to distribute the_string_to_slug in your own private RubyGems registry
12 Releases
RubyGems on Cloudsmith