lib/ronin/extensions/ip_addr.rb in ronin-support-0.5.0 vs lib/ronin/extensions/ip_addr.rb in ronin-support-0.5.1
- old
+ new
@@ -64,16 +64,13 @@
#
def IPAddr.extract(text,version=nil,&block)
return enum_for(__method__,text,version).to_a unless block_given?
regexp = case version
- when :ipv4, :v4, 4
- Regexp::IPv4
- when :ipv6, :v6, 6
- Regexp::IPv6
- else
- Regexp::IP
+ when :ipv4, :v4, 4 then Regexp::IPv4
+ when :ipv6, :v6, 6 then Regexp::IPv6
+ else Regexp::IP
end
text.scan(regexp) do |match|
yield match
end
@@ -126,13 +123,11 @@
if cidr_or_glob.include?('::')
separator = '::'
base = 16
- prefix = if cidr_or_glob.start_with?('::')
- '::'
- else
- ''
+ prefix = if cidr_or_glob.start_with?('::') then '::'
+ else ''
end
format = lambda { |address|
prefix + address.map { |i| '%.2x' % i }.join('::')
}