Class: ServiceObjects::SendArpPackets
- Inherits:
-
Object
- Object
- ServiceObjects::SendArpPackets
- Defined in:
- lib/ownlan/service_objects/send_arp_packets.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#packets ⇒ Object
readonly
Returns the value of attribute packets.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config, packets) ⇒ SendArpPackets
constructor
A new instance of SendArpPackets.
Constructor Details
#initialize(config, packets) ⇒ SendArpPackets
Returns a new instance of SendArpPackets.
5 6 7 8 |
# File 'lib/ownlan/service_objects/send_arp_packets.rb', line 5 def initialize(config, packets) @config = config @packets = [packets].flatten end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/ownlan/service_objects/send_arp_packets.rb', line 3 def config @config end |
#packets ⇒ Object (readonly)
Returns the value of attribute packets.
3 4 5 |
# File 'lib/ownlan/service_objects/send_arp_packets.rb', line 3 def packets @packets end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ownlan/service_objects/send_arp_packets.rb', line 10 def call @i = 0 loop do packets.each do |packet| @i += 1 packet.to_w(config.interface) print "\r The ARP packet has been sent successfully #{@i} times" sleep config.delay end end end |