Class: DataMapper::Property::Legacy::HTMLText

Inherits:
Text
  • Object
show all
Defined in:
lib/dm-core/property/legacy/html_text.rb

Instance Method Summary collapse

Instance Method Details

#dump(value) ⇒ String?

HTML escapes data.

Parameters:

  • value (String, nil)

    The raw data.

Returns:

  • (String, nil)

    The HTML escaped data.



32
33
34
# File 'lib/dm-core/property/legacy/html_text.rb', line 32

def dump(value)
  CGI.escape_html(value) unless value.nil?
end

#load(value) ⇒ String?

Unescaped HTML escaped data.

Parameters:

  • value (String, nil)

    The HTML escaped data.

Returns:

  • (String, nil)

    The HTML unescaped data.



19
20
21
# File 'lib/dm-core/property/legacy/html_text.rb', line 19

def load(value)
  CGI.unescape_html(value) unless value.nil?
end