Sha256: f932c75957e14a00f7ae37aa2b6b64bdf90718ff689ead4cf8717eee75d16c33

Contents?: true

Size: 446 Bytes

Versions: 1

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

require 'pio/icmp/format'
require 'pio/icmp/reply'
require 'pio/icmp/request'
require 'pio/parse_error'

module Pio
  # Icmp parser and generator.
  class Icmp
    def self.read(raw_data)
      format = Format.read(raw_data)
      { Request.icmp_type => Request,
        Reply.icmp_type => Reply }.fetch(format.icmp_type).create(format)
    rescue
      raise Pio::ParseError, $ERROR_INFO.message
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.2 lib/pio/icmp.rb