Module: BSD::Control

Defined in:
lib/bsd/control.rb,
lib/bsd/control/feature.rb,
lib/bsd/control/version.rb

Defined Under Namespace

Modules: FFI Classes: Feature

Constant Summary collapse

Error =
Class.new(RuntimeError)
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.available_featuresArray<BSD::Control::Feature>

Returns an array of available features.

Returns:



15
16
17
# File 'lib/bsd/control.rb', line 15

def self.available_features
  Feature.available
end

.feature(name) ⇒ BSD::Control::Feature

Returns an instance of BSD::Control::Feature.

Examples:

BSD::Control
  .feature(:mprotect)
  .enable!("/usr/local/bin/emacs-29.2")

Parameters:

  • name (String)

    The name of a feature.

Returns:

Raises:



33
34
35
36
# File 'lib/bsd/control.rb', line 33

def self.feature(name)
  feature = available_features.find { _1.name == name.to_s }
  feature ? feature : raise(Error, "feature '#{name}' wasn't found")
end

.library_versionString

Returns the version of libhbsdcontrol.

Returns:

  • (String)

    Returns the version of libhbsdcontrol.



8
9
10
# File 'lib/bsd/control.rb', line 8

def self.library_version
  FFI.library_version
end