Class: ScripTTY::Net::EventLoop::SocketChannelWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/scriptty/net/event_loop.rb

Direct Known Subclasses

ConnectionWrapper, ListeningSocketWrapper

Instance Method Summary collapse

Constructor Details

#initialize(master, channel) ⇒ SocketChannelWrapper

:nodoc:



522
523
524
525
# File 'lib/scriptty/net/event_loop.rb', line 522

def initialize(master, channel) # :nodoc:
  @master = master
  @channel = channel
end

Instance Method Details

#closeObject



527
528
529
530
# File 'lib/scriptty/net/event_loop.rb', line 527

def close
  @master.send(:close_channel, @channel)
  nil
end

#local_addressObject



537
538
539
# File 'lib/scriptty/net/event_loop.rb', line 537

def local_address
  EventLoop.unparse_address(@channel.socket.getLocalSocketAddress)
end

#on_close(&callback) ⇒ Object



532
533
534
535
# File 'lib/scriptty/net/event_loop.rb', line 532

def on_close(&callback)
  @master.send(:set_on_close_callback, @channel, &callback)
  self
end