Sha256: 0432a89c01eb52d008ff96f82ee7a1efc08c3d490a4c3ee60c97281a1411e84a

Contents?: true

Size: 381 Bytes

Versions: 8

Compression:

Stored size: 381 Bytes

Contents

require 'ipaddr'

module Barometer
  module Query
    module Format
      #
      # eg. 8.8.8.8
      #
      class Ipv4Address < Base
        def self.is?(query)
          (ipaddr = IPAddr.new(query.to_s)) && ipaddr.ipv4?
        rescue ArgumentError
        end
      end
    end
  end
end

Barometer::Query::Format.register(:ipv4_address, Barometer::Query::Format::Ipv4Address)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.6 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.5 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.4 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.3 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.2 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.1 lib/barometer/query/formats/ipv4_address.rb
barometer-0.9.0 lib/barometer/query/formats/ipv4_address.rb