Class: Nl::Raw::Family

Inherits:
Family
  • Object
show all
Defined in:
nl/lib/nl/raw.rb

Overview

Base class for Raw Netlink families.

Class Method Summary collapse

Class Method Details

.open(executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) ⇒ Family .open(executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) {|session| ... } ⇒ Object

Opens a session for this raw Netlink family.

Overloads:

  • .open(executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) ⇒ Family

    The caller is responsible for closing the session.

    Parameters:

    • executor (:thread, :fiber, nil) (defaults to: nil) —

      the asynchronous executor, or nil for blocking operation

    • notification_capacity (Integer) (defaults to: DEFAULT_NOTIFICATION_CAPACITY) —

      the maximum number of queued notifications

    Returns:

    • (Family) —

      the opened family session

  • .open(executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY) {|session| ... } ⇒ Object

    The session is automatically closed after the block returns.

    Parameters:

    • executor (:thread, :fiber, nil) (defaults to: nil) —

      the asynchronous executor, or nil for blocking operation

    • notification_capacity (Integer) (defaults to: DEFAULT_NOTIFICATION_CAPACITY) —

      the maximum number of queued notifications

    Yield Parameters:

    • session (Family) —

      the opened family session

    Returns:

    • (Object) —

      the value returned from the block



27
28
29
30
31
32
33
34
35
36
# File 'nl/lib/nl/raw.rb', line 27

def self.open(executor: nil, notification_capacity: DEFAULT_NOTIFICATION_CAPACITY)
  session = build_session(executor:, notification_capacity:)
  return session unless block_given?

  begin
    yield session
  ensure
    session.close
  end
end