Skip to content

Commit b0c2095

Browse files
authored
Merge pull request #635 from hilary/refactor_slugify
generator: use file methods to manipulate filenames :)
2 parents dc9c750 + ff6e301 commit b0c2095

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/generator/files/generator_cases.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def cases_filepaths(track_path)
2424
end
2525

2626
def slugify(filepath)
27-
%r{([^/]*)_case\.rb$}.match(filepath).captures[0].tr('_', '-')
27+
File.basename(filepath, '_case.rb').tr('_', '-')
2828
end
2929

3030
def filename(exercise_name_or_slug)

0 commit comments

Comments
 (0)