Module: GovukSchemas::Utils

Defined in:
lib/govuk_schemas/utils.rb

Class Method Summary collapse

Class Method Details

.parameterize(string) ⇒ Object


12
13
14
# File 'lib/govuk_schemas/utils.rb', line 12

def self.parameterize(string)
  string.gsub(/[^a-z0-9\-_]+/i, '-')
end

.stringify_keys(hash) ⇒ Object


4
5
6
7
8
9
10
# File 'lib/govuk_schemas/utils.rb', line 4

def self.stringify_keys(hash)
  new_hash = {}
  hash.each do |k, v|
    new_hash[k.to_s] = v
  end
  new_hash
end