Class: Jruby::Pcap::FileHandle

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/jruby-pcap/file_handle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ FileHandle

Returns a new instance of FileHandle.



10
11
12
# File 'lib/jruby-pcap/file_handle.rb', line 10

def initialize(handle)
  @handle = handle
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



8
9
10
# File 'lib/jruby-pcap/file_handle.rb', line 8

def handle
  @handle
end

Instance Method Details

#eachObject



14
15
16
17
18
19
# File 'lib/jruby-pcap/file_handle.rb', line 14

def each
  next_packet = @handle.next_packet_ex
  if next_packet
    yield Jruby::Pcap::Packet.new(next_packet, @handle)
  end
end