Class: Resolv::DNS::Requester

Inherits:
Object
  • Object
show all
Defined in:
lib/logmerge/resolv.rb

Direct Known Subclasses

ConnectedUDP, TCP, UnconnectedUDP

Defined Under Namespace

Classes: ConnectedUDP, RequestError, Sender, TCP, UnconnectedUDP

Instance Method Summary collapse

Constructor Details

#initializeRequester

Returns a new instance of Requester.



532
533
534
# File 'lib/logmerge/resolv.rb', line 532

def initialize
  @senders = {}
end

Instance Method Details

#closeObject



536
537
538
539
540
541
542
543
544
545
546
# File 'lib/logmerge/resolv.rb', line 536

def close
  thread, sock, @thread, @sock = @thread, @sock
  begin
    if thread
      thread.kill
      thread.join
    end
  ensure
    sock.close if sock
  end
end

#delete(arg) ⇒ Object



548
549
550
551
552
553
554
555
556
557
# File 'lib/logmerge/resolv.rb', line 548

def delete(arg)
  case arg
  when Sender
    @senders.delete_if {|k, s| s == arg }
  when Queue
    @senders.delete_if {|k, s| s.queue == arg }
  else
    raise ArgumentError.new("neither Sender or Queue: #{arg}")
  end
end