Parent

DataMapper::Property::IPAddress

Public Instance Methods

dump(value) click to toggle source
    # File lib/dm-types/ip_address.rb, line 32
32:       def dump(value)
33:         value.to_s unless value.nil?
34:       end
load(value) click to toggle source
    # File lib/dm-types/ip_address.rb, line 18
18:       def load(value)
19:         if value.nil?
20:           nil
21:         elsif value.is_a?(::String)
22:           unless value.empty?
23:             IPAddr.new(value)
24:           else
25:             IPAddr.new("0.0.0.0")
26:           end
27:         else
28:           raise ArgumentError.new("+value+ must be nil or a String")
29:         end
30:       end
primitive?(value) click to toggle source
    # File lib/dm-types/ip_address.rb, line 10
10:       def primitive?(value)
11:         value.kind_of?(IPAddr)
12:       end
typecast_to_primitive(value) click to toggle source
    # File lib/dm-types/ip_address.rb, line 36
36:       def typecast_to_primitive(value)
37:         load(value)
38:       end
valid?(value, negated = false) click to toggle source
    # File lib/dm-types/ip_address.rb, line 14
14:       def valid?(value, negated = false)
15:         super || dump(value).kind_of?(::String)
16:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.