Sha256: d25c0c5dd555d22a70d675e96603d1428abac1077a01ab0f243258397ecb4ad4

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require 'dm-core'

require 'cgi'

module DataMapper
  class Property
    module Legacy
      class HTMLText < Text

        #
        # Unescaped HTML escaped data.
        #
        # @param [String, nil] value
        #   The HTML escaped data.
        #
        # @return [String, nil]
        #   The HTML unescaped data.
        #
        def load(value)
          CGI.unescape_html(value) unless value.nil?
        end

        #
        # HTML escapes data.
        #
        # @param [String, nil] value
        #   The raw data.
        #
        # @return [String, nil]
        #   The HTML escaped data.
        #
        def dump(value)
          CGI.escape_html(value) unless value.nil?
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-types-legacy-0.1.1 lib/dm-core/property/legacy/html_text.rb
dm-types-legacy-0.1.0 lib/dm-core/property/legacy/html_text.rb