mirror of
https://gitlab.silvrtree.co.uk/martind2000/sensortoy-app.git
synced 2025-02-06 06:59:17 +00:00
17 lines
374 B
Ruby
17 lines
374 B
Ruby
|
require "sanitize"
|
||
|
|
||
|
class Helpers
|
||
|
def self.clean(input)
|
||
|
return Sanitize.fragment(input)
|
||
|
.downcase
|
||
|
.gsub(/\s+/, "-")
|
||
|
.gsub(/^([A-Za-z0-9\-_.:]+).*?$/, "\\1")
|
||
|
.gsub(/^\./, "")
|
||
|
.gsub(/\.$/, "")
|
||
|
.gsub(/[^A-Za-z0-9\-_.]/, "")
|
||
|
.sub(/^-+/, "")
|
||
|
.sub(/-+$/, "")
|
||
|
|
||
|
end
|
||
|
end
|