lib/ronin/extensions/ip_addr.rb in ronin-support-0.1.0 vs lib/ronin/extensions/ip_addr.rb in ronin-support-0.2.0.rc1
- old
+ new
@@ -51,10 +51,12 @@
# An IP Address from the text.
#
# @return [Array<String>]
# The IP Addresses found in the text.
#
+ # @api public
+ #
def IPAddr.extract(text,version=nil,&block)
regexp = case version
when :ipv4
IPV4_REGEXP
when :ipv6
@@ -106,10 +108,12 @@
# @example Enumerate through a globbed IPv6 range
# IPAddr.each('::ff::02-0a::c3') do |ip|
# puts ip
# end
#
+ # @api public
+ #
def IPAddr.each(cidr_or_glob,&block)
unless (cidr_or_glob.include?('*') || cidr_or_glob.include?('-'))
return IPAddr.new(cidr_or_glob).each(&block)
end
@@ -166,10 +170,12 @@
# Resolves the host-names for the IP address.
#
# @return [Array<String>]
# The host-names for the IP address.
#
+ # @api public
+ #
def lookup
Resolv.getnames(self.to_s)
end
#
@@ -187,9 +193,11 @@
# netblock = IPAddr.new('10.1.1.1/24')
#
# netblock.each do |ip|
# puts ip
# end
+ #
+ # @api public
#
def each
return enum_for(:each) unless block_given?
case @family