module GeoCombine::Formatting
Mixin used for formatting metadata fields
Public Instance Methods
remove_lines(text)
click to toggle source
Removes line breaks from a text input @param [String] text @return [String]
# File lib/geo_combine/formatting.rb, line 17 def remove_lines(text) text.delete("\n") end
sanitize(text)
click to toggle source
Sanitizes html from a text input @param [String] text @return [String]
# File lib/geo_combine/formatting.rb, line 9 def sanitize(text) Sanitize.fragment(text) end
sanitize_and_remove_lines(text)
click to toggle source
Sanitizes and removes lines from a text block @param [String] text @return [String]
# File lib/geo_combine/formatting.rb, line 25 def sanitize_and_remove_lines(text) remove_lines(sanitize(text)) end
sluggify(slug)
click to toggle source
slugs should be lowercase and only have a-z, A-Z, 0-9, and -
# File lib/geo_combine/formatting.rb, line 30 def sluggify(slug) slug.gsub(/[^a-zA-Z0-9\-]/, '-').gsub(/[\-]+/, '-').downcase end