diff options
author | Mike Mackintosh <m@zyp.io> | 2015-03-22 10:53:41 -0400 |
---|---|---|
committer | Mike Mackintosh <m@zyp.io> | 2015-03-22 10:53:41 -0400 |
commit | 4c759982e386e2ebdd99346c67caef3dce55e583 (patch) | |
tree | 0828925238079b0018c00cfc4f029fff2afa6fec /lib/ipaddress/ipv4.rb | |
parent | a52c3f9221bed83e1a3981eafe09e83b8b3703ad (diff) | |
download | ipaddress-4c759982e386e2ebdd99346c67caef3dce55e583.tar.gz |
added multicast
Diffstat (limited to 'lib/ipaddress/ipv4.rb')
-rw-r--r-- | lib/ipaddress/ipv4.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ipaddress/ipv4.rb b/lib/ipaddress/ipv4.rb index a32a4a0..38afbb1 100644 --- a/lib/ipaddress/ipv4.rb +++ b/lib/ipaddress/ipv4.rb @@ -585,6 +585,20 @@ module IPAddress; 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 # for DNS lookups # |