lib/legitbot/ahrefs.rb in legitbot-0.3.2 vs lib/legitbot/ahrefs.rb in legitbot-0.4.0

- old
+ new

@@ -1,13 +1,18 @@ -module Legitbot +# frozen_string_literal: true + +module Legitbot # :nodoc: # https://ahrefs.com/robot class Ahrefs < BotMatch - Ranges = %w(54.36.148.0/24 54.36.149.0/24 54.36.150.0/24 195.154.122.0/24 195.154.123.0/24 195.154.126.0/24 195.154.127.0/24) - - def valid? - ip = IPAddr.new @ip - Ranges.any? { |range| IPAddr.new(range).include? ip } - end + ip_ranges %w[ + 54.36.148.0/24 + 54.36.149.0/24 + 54.36.150.0/24 + 195.154.122.0/24 + 195.154.123.0/24 + 195.154.126.0/24 + 195.154.127.0/24 + ] end - rule Legitbot::Ahrefs, %w(AhrefsBot) + rule Legitbot::Ahrefs, %w[AhrefsBot] end