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



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

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

.load(value, property) ⇒ Object



9
10
11
# File 'lib/dm-types/uri.rb', line 9

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

.typecast(value, property) ⇒ Object



18
19
20
# File 'lib/dm-types/uri.rb', line 18

def self.typecast(value, property)
  value.kind_of?(Addressable::URI) ? value : load(value.to_s, property)
end