From 45118a2771085eee8eead69dc9487945fe1465e4 Mon Sep 17 00:00:00 2001 From: Erran Carey Date: Thu, 2 Apr 2015 07:48:27 -0500 Subject: [PATCH] Allow IPRange#include? to accept String arguments --- lib/nexpose/site.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/nexpose/site.rb b/lib/nexpose/site.rb index 57ad8313..5c039518 100644 --- a/lib/nexpose/site.rb +++ b/lib/nexpose/site.rb @@ -723,11 +723,14 @@ def eql?(other) @from == other.from && @to == other.to end - def include?(single_ip) - return false unless single_ip.respond_to? :from + def include?(subset) from = IPAddr.new(@from) to = @to.nil? ? from : IPAddr.new(@to) - other = IPAddr.new(single_ip) + if subset.respond_to?(:from) + other = IPAddr.new(subset.from) + else + other = IPAddr.new(subset) + end if other < from false