Module: NNG
- Defined in:
- lib/nng.rb,
lib/nng/ffi.rb,
lib/nng/errors.rb,
lib/nng/socket.rb,
lib/nng/message.rb,
lib/nng/version.rb,
lib/nng/protocols.rb
Overview
NNG (nanomsg-next-generation) Ruby bindings
Defined Under Namespace
Modules: FFI, Protocols Classes: AddressInUse, Closed, ConnectionAborted, ConnectionError, ConnectionRefused, ConnectionReset, Error, Message, MessageSize, NoMemory, ProtocolError, ResourceError, Socket, StateError, TimeoutError
Constant Summary collapse
- ERROR_MAP =
Map error codes to exception classes
{ FFI::NNG_ETIMEDOUT => TimeoutError, FFI::NNG_ECONNREFUSED => ConnectionRefused, FFI::NNG_ECONNABORTED => ConnectionAborted, FFI::NNG_ECONNRESET => ConnectionReset, FFI::NNG_ECLOSED => Closed, FFI::NNG_EADDRINUSE => AddressInUse, FFI::NNG_ENOMEM => NoMemory, FFI::NNG_EMSGSIZE => MessageSize, FFI::NNG_EPROTO => ProtocolError, FFI::NNG_ESTATE => StateError }.freeze
- VERSION =
'1.0.1'
Class Method Summary collapse
-
.fini ⇒ Object
Cleanup NNG library (optional, called automatically at exit).
-
.lib_version ⇒ String
NNG library version (from C library).
-
.raise_error(code, message) ⇒ Object
Raise appropriate exception for error code.
-
.version ⇒ String
NNG library version.
Class Method Details
.fini ⇒ Object
Cleanup NNG library (optional, called automatically at exit)
45 46 47 |
# File 'lib/nng.rb', line 45 def self.fini FFI.nng_fini end |
.lib_version ⇒ String
NNG library version (from C library)
40 41 42 |
# File 'lib/nng.rb', line 40 def self.lib_version FFI.nng_version end |
.raise_error(code, message) ⇒ Object
Raise appropriate exception for error code
44 45 46 47 |
# File 'lib/nng/errors.rb', line 44 def self.raise_error(code, ) error_class = ERROR_MAP[code] || Error raise error_class, end |
.version ⇒ String
NNG library version
34 35 36 |
# File 'lib/nng.rb', line 34 def self.version VERSION end |