Class: Pio::Arp::Reply::Options

Inherits:
Options
  • Object
show all
Defined in:
lib/pio/arp/reply.rb

Overview

User options for creating an Arp Reply.

Instance Method Summary collapse

Methods inherited from Options

mandatory_option, option

Constructor Details

#initialize(options) ⇒ Options

Returns a new instance of Options.



19
20
21
22
23
24
25
26
27
# File 'lib/pio/arp/reply.rb', line 19

def initialize(options)
  validate options
  @source_mac = Mac.new(options[:source_mac]).freeze
  @destination_mac = Mac.new(options[:destination_mac]).freeze
  @sender_protocol_address =
    IPv4Address.new(options[:sender_protocol_address]).freeze
  @target_protocol_address =
    IPv4Address.new(options[:target_protocol_address]).freeze
end

Instance Method Details

#to_hashObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pio/arp/reply.rb', line 29

def to_hash
  {
    operation: OPERATION,
    source_mac: @source_mac,
    destination_mac: @destination_mac,
    sender_hardware_address: @source_mac,
    target_hardware_address: @destination_mac,
    sender_protocol_address: @sender_protocol_address,
    target_protocol_address: @target_protocol_address
  }.freeze
end