Class: DataMapper::Types::URI

Inherits:
DataMapper::Type
  • Object
show all
Defined in:
lib/dm-types/uri.rb

Class Method Summary collapse

Class Method Details

.dump(value, property) ⇒ Object



16
17
18
# File 'lib/dm-types/uri.rb', line 16

def self.dump(value, property)
  value.to_s unless value.nil?
end

.load(value, property) ⇒ Object

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



12
13
14
# File 'lib/dm-types/uri.rb', line 12

def self.load(value, property)
  Addressable::URI.parse(value)
end

.typecast(value, property) ⇒ Object



20
21
22
# File 'lib/dm-types/uri.rb', line 20

def self.typecast(value, property)
  load(value, property)
end