Sha256: 1a2a69315f31a8efc631d88768f0781e12b087a4d0865bee1220d1fbd371ebb2

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

require 'pio/class_inspector'
require 'pio/icmp/format'
require 'pio/instance_inspector'
require 'pio/message'
require 'pio/ruby_dumper'

module Pio
  class Icmp
    # Base class of Icmp::Request and Icmp::Reply.
    class Message < Pio::Message
      extend ClassInspector
      include InstanceInspector

      def self.fields
        Icmp::Format.fields
      end

      def self.create(format)
        allocate.tap do |message|
          message.instance_variable_set :@format, format
        end
      end

      def initialize(user_options)
        @format = Icmp::Format.new(parse_options(user_options))
      end

      def method_missing(method, *args)
        @format.__send__(method, *args)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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