Class: DataMapper::Types::IPAddress
- Object
- DataMapper::Type
- DataMapper::Types::IPAddress
Constants Inherited from DataMapper::Type
Public Visibility
Public Instance Methods Inherited from Object
Public Class Method Details
dump
public
dump(value, property)
[View source]
20 21 22 23
# File 'dm-more/dm-types/lib/dm-types/ip_address.rb', line 20 def self.dump(value, property) return nil if value.nil? value.to_s end
load
public
load(value, property)
[View source]
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# File 'dm-more/dm-types/lib/dm-types/ip_address.rb', line 8 def self.load(value, property) if value.nil? nil elsif value.is_a?(String) && !value.empty? IPAddr.new(value) elsif value.is_a?(String) && value.empty? IPAddr.new("0.0.0.0") else raise ArgumentError.new("+value+ must be nil or a String") end end