Sha256: bd494234c20ae2eaa6acb129ba1e8d6e4653d4609aad9cf9ab30bd71e421cb19

Contents?: true

Size: 598 Bytes

Versions: 15

Compression:

Stored size: 598 Bytes

Contents

require 'ardm/property/string'
require 'addressable/uri'

module Ardm
  class Property
    class URI < String
      load_as Addressable::URI

      # Maximum length chosen based on recommendation:
      # http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-an-url
      length 2000

      def load(value)
        Addressable::URI.parse(value) unless value.nil?
      end

      def dump(value)
        value.to_s unless value.nil?
      end

      def typecast(value)
        load(value) unless value.nil?
      end

    end # class URI
  end # class Property
end # module Ardm

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 lib/ardm/property/uri.rb
ardm-0.4.0 lib/ardm/property/uri.rb
ardm-0.3.2 lib/ardm/property/uri.rb
ardm-0.3.1 lib/ardm/property/uri.rb
ardm-0.3.0 lib/ardm/property/uri.rb
ardm-0.2.7 lib/ardm/property/uri.rb
ardm-0.2.6 lib/ardm/property/uri.rb
ardm-0.2.5 lib/ardm/property/uri.rb
ardm-0.2.4 lib/ardm/property/uri.rb
ardm-0.2.3 lib/ardm/property/uri.rb
ardm-0.2.2 lib/ardm/property/uri.rb
ardm-0.2.1 lib/ardm/property/uri.rb
ardm-0.2.0 lib/ardm/property/uri.rb
ardm-0.1.0 lib/ardm/property/uri.rb
ardm-0.0.1 lib/ardm/property/uri.rb