Method: EZMQ::Socket#initialize
- Defined in:
- lib/ezmq/socket.rb
#initialize(mode, type, **options) ⇒ Socket
Note:
port is ignored unless transport is one of :tcp, :pgm or :epgm
Creates a 0MQ socket.
26 27 28 29 30 31 32 33 34 |
# File 'lib/ezmq/socket.rb', line 26 def initialize(mode, type, **) fail ArgumentError unless %i(bind connect).include? mode @context = [:context] || EZMQ::Context.new @socket = @context.socket type @encode = [:encode] || -> m { m } @decode = [:decode] || -> m { m } endpoint = .select { |k, _| %i(transport address port).include? k } method(mode).call endpoint end |