Module: Uffizzi::ProjectHelper
- Defined in:
- lib/uffizzi/helpers/project_helper.rb
Constant Summary collapse
- SLUG_ENDING_LENGTH =
6
Class Method Summary collapse
Class Method Details
.generate_default_params ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/uffizzi/helpers/project_helper.rb', line 9 def generate_default_params name = generate_name { name: name, description: default_description, slug: generate_slug(name), } end |
.generate_slug(name) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/uffizzi/helpers/project_helper.rb', line 18 def generate_slug(name) formatted_name = name.downcase.gsub(/ /, '-').gsub(/[^\w-]+/, '') slug_ending = generate_random_string(SLUG_ENDING_LENGTH) "#{formatted_name}-#{slug_ending}" end |