Skip to content

Commit

Permalink
Remove Utils lib
Browse files Browse the repository at this point in the history
This only had one (untested) method, called in one place.
I've now moved its contents directly to where it was being
used.

It's not great having both 'helpers' and 'utils' in the
same directory, so this is a tidier solution.
  • Loading branch information
ChrisBAshton committed Jul 23, 2020
1 parent 39513c1 commit ce681b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion lib/govuk_schemas.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "govuk_schemas/version"
require "govuk_schemas/schema"
require "govuk_schemas/utils"
require "govuk_schemas/random_example"
require "govuk_schemas/document_types"
require "govuk_schemas/example"
Expand Down
5 changes: 4 additions & 1 deletion lib/govuk_schemas/random_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def anchor
end

def random_identifier(separator:)
Utils.parameterize(WORDS.sample(@random.rand(1..10), random: @random).join("-")).gsub("-", separator)
WORDS.sample(@random.rand(1..10), random: @random)
.join("-")
.gsub(/[^a-z0-9\-_]+/i, "-")
.gsub("-", separator)
end

def uuid
Expand Down
8 changes: 0 additions & 8 deletions lib/govuk_schemas/utils.rb

This file was deleted.

0 comments on commit ce681b0

Please sign in to comment.