Module: GeoCombine::Formatting

Included in:
EsriOpenData
Defined in:
lib/geo_combine/formatting.rb

Overview

Mixin used for formatting metadata fields

Instance Method Summary collapse

Instance Method Details

#remove_lines(text) ⇒ String

Removes line breaks from a text input

Parameters:

  • text (String)

Returns:

  • (String)


17
18
19
# File 'lib/geo_combine/formatting.rb', line 17

def remove_lines(text)
  text.gsub(/\n/, '')
end

#sanitize(text) ⇒ String

Sanitizes html from a text input

Parameters:

  • text (String)

Returns:

  • (String)


9
10
11
# File 'lib/geo_combine/formatting.rb', line 9

def sanitize(text)
  Sanitize.fragment(text)
end

#sanitize_and_remove_lines(text) ⇒ String

Sanitizes and removes lines from a text block

Parameters:

  • text (String)

Returns:

  • (String)


25
26
27
# File 'lib/geo_combine/formatting.rb', line 25

def sanitize_and_remove_lines(text)
  remove_lines(sanitize(text))
end