Sha256: 8b1c7c85da50b885593bec32023813503c9d4671e6b6c90a5a9bc68374480339

Contents?: true

Size: 496 Bytes

Versions: 14

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Concerns
    #
    # Autonomous System concern
    #
    module AutonomousSystemNormalizable
      extend ActiveSupport::Concern

      #
      # Normalize ASN value
      #
      # @param [String, Integer] asn
      #
      # @return [Integer]
      #
      def normalize_asn(asn)
        return asn if asn.is_a?(Integer)
        return asn.to_i unless asn.start_with?("AS")

        asn.delete_prefix("AS").to_i
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mihari-7.3.2 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.3.1 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.3.0 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.2.0 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.1.3 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.1.2 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.1.1 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.1.0 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.5 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.4 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.3 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.2 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.1 lib/mihari/concerns/autonomous_system_normalizable.rb
mihari-7.0.0 lib/mihari/concerns/autonomous_system_normalizable.rb