Module: OMQ

Defined in:
lib/omq/rs.rb,
lib/omq/rs/socket.rb,
lib/omq/rs/version.rb

Overview

Brokerless messaging APIs and language backends.

Defined Under Namespace

Modules: Rust

Class Method Summary collapse

Class Method Details

.rs(socket_type = nil, **options) {|socket| ... } ⇒ Module, ...

Returns the OMQ.rs namespace or creates an OMQ.rs-backed socket.

Parameters:

  • socket_type (Symbol, String, nil) (defaults to: nil)

    socket pattern, such as :push

  • options (Hash)

    socket options passed to OMQ::Rust.socket

Yields:

  • (socket)

    yields a newly created socket and closes it afterward

Yield Parameters:

Returns:

  • (Module, Rust::Socket, Object)

    the namespace, socket, or block result

Raises:

  • (ArgumentError)

    if socket_type is unknown or an option is invalid



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/omq/rs.rb', line 18

def rs(socket_type = nil, **options)
  return Rust if socket_type.nil?

  socket = Rust.socket(socket_type, **options)
  return socket unless block_given?

  begin
    yield socket
  ensure
    socket.close
  end
end