Skip to content
Snippets Groups Projects
Commit 4c759982 authored by Mike Mackintosh's avatar Mike Mackintosh
Browse files

added multicast

parent a52c3f92
Branches
Tags 5.8.2
No related merge requests found
...@@ -584,6 +584,20 @@ module IPAddress; ...@@ -584,6 +584,20 @@ module IPAddress;
self.class.new("192.168.0.0/16")].any? {|i| i.include? self} self.class.new("192.168.0.0/16")].any? {|i| i.include? self}
end end
#
# Checks if an IPv4 address objects belongs
# to a multicast network RFC3171
#
# Example:
#
# ip = IPAddress "224.0.0.0/4"
# ip.multicast?
# #=> true
#
def multicast?
[self.class.new("224.0.0.0/4")].any? {|i| i.include? self}
end
# #
# Returns the IP address in in-addr.arpa format # Returns the IP address in in-addr.arpa format
# for DNS lookups # for DNS lookups
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment