Sha256: 6b802d9f4ffbf44c7f07e5332444b06f70211409b64da53c44111d1a98505cc4

Contents?: true

Size: 470 Bytes

Versions: 21

Compression:

Stored size: 470 Bytes

Contents

module IPAddrExtensions
  extend ActiveSupport::Concern
  included do
    alias_method_chain :coerce_other, :rescue
  end
  
  def coerce_other_with_rescue(other)
    begin
      case other
      when IPAddr
        other
      when String
        self.class.new(other)
      else
        self.class.new(other, @family)
      end
    rescue ArgumentError => e
      OpenStruct.new(family: false, to_i: false)
    end
  end
  
end

IPAddr.send(:include, IPAddrExtensions)

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
metasploit_data_models-2.0.7 config/initializers/ipaddr.rb