Parent

Class Index [+]

Quicksearch

Dnsruby::IPv4

Constants

Regex

Regular expression IPv4 addresses must match

Attributes

address[R]

A String representation of the IPv4 address.

Public Class Methods

create(arg) click to toggle source
    # File lib/Dnsruby/ipv4.rb, line 21
21:     def self.create(arg)
22:       case arg
23:       when IPv4
24:         return arg
25:       when Regex
26:         if (0..255) === (a = $1.to_i) &&
27:          (0..255) === (b = $2.to_i) &&
28:          (0..255) === (c = $3.to_i) &&
29:          (0..255) === (d = $4.to_i)
30:           return self.new([a, b, c, d].pack("CCCC"))
31:         else
32:           raise ArgumentError.new("IPv4 address with invalid value: " + arg)
33:         end
34:       else
35:         raise ArgumentError.new("cannot interpret as IPv4 address: #{arg.inspect}")
36:       end
37:     end

Public Instance Methods

==(other) click to toggle source
    # File lib/Dnsruby/ipv4.rb, line 62
62:     def ==(other)
63:       return @address == other.address
64:     end
eql?(other) click to toggle source
    # File lib/Dnsruby/ipv4.rb, line 66
66:     def eql?(other)
67:       return self == other
68:     end
hash() click to toggle source
    # File lib/Dnsruby/ipv4.rb, line 70
70:     def hash
71:       return @address.hash
72:     end
to_name() click to toggle source
    # File lib/Dnsruby/ipv4.rb, line 57
57:     def to_name
58:       return Name.create(
59:         '%d.%d.%d.%d.in-addr.arpa.' % @address.unpack('CCCC').reverse)
60:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.