Parent

DataMapper::Property::IPAddress

Public Instance Methods

dump(value) click to toggle source
# File lib/dm-types/ip_address.rb, line 32
def dump(value)
  value.to_s unless value.nil?
end
load(value) click to toggle source
# File lib/dm-types/ip_address.rb, line 18
def load(value)
  if value.nil?
    nil
  elsif value.is_a?(::String)
    unless value.empty?
      IPAddr.new(value)
    else
      IPAddr.new("0.0.0.0")
    end
  else
    raise ArgumentError.new("+value+ must be nil or a String")
  end
end
primitive?(value) click to toggle source
# File lib/dm-types/ip_address.rb, line 10
def primitive?(value)
  value.kind_of?(IPAddr)
end
typecast_to_primitive(value) click to toggle source
# File lib/dm-types/ip_address.rb, line 36
def typecast_to_primitive(value)
  load(value)
end
valid?(value, negated = false) click to toggle source
# File lib/dm-types/ip_address.rb, line 14
def valid?(value, negated = false)
  super || dump(value).kind_of?(::String)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.