Module: TheStringToSlug

Defined in:
lib/the_string_to_slug.rb,
lib/the_string_to_slug/version.rb

Constant Summary collapse

VERSION =
"1.4"

Class Method Summary collapse

Class Method Details

.basic_parametrize(str, sep) ⇒ Object



6
7
8
# File 'lib/the_string_to_slug.rb', line 6

def basic_parametrize(str, sep)
  str.gsub('_', sep).gsub('-', sep)
end

.parameterize(str, sep) ⇒ Object



10
11
12
13
14
# File 'lib/the_string_to_slug.rb', line 10

def parameterize(str, sep)
  Rails::VERSION::MAJOR > 4          ? \
    str.parameterize(separator: sep) : \
    str.parameterize(sep)
end