From 5de096abdefde75b1006485afa4c9ca21aa6f424 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 12 May 2024 20:01:03 -0300 Subject: [PATCH] Update docs --- ext/bsdcontrol.rb/context.c | 2 +- lib/bsd/control.rb | 14 ++++----- lib/bsd/control/feature.rb | 62 ++++++++++++++++++------------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ext/bsdcontrol.rb/context.c b/ext/bsdcontrol.rb/context.c index 2d8cc53..28e1393 100644 --- a/ext/bsdcontrol.rb/context.c +++ b/ext/bsdcontrol.rb/context.c @@ -11,7 +11,7 @@ VALUE bsdcontrol_context_alloc(VALUE klass) { hbsdctrl_ctx_t *ctx; - ctx = hbsdctrl_ctx_new(FLAGS, NAMESPACE); + ctx = hbsdctrl_ctx_new(FLAGS, NAMESPACE); if (ctx == NULL) { rb_raise(rb_eSystemCallError, "hbsdctrl_ctx_new"); diff --git a/lib/bsd/control.rb b/lib/bsd/control.rb index 8998652..5ef5523 100644 --- a/lib/bsd/control.rb +++ b/lib/bsd/control.rb @@ -8,21 +8,21 @@ module BSD::Control ## # @return [BSD::Control::Context] - # Returns an instance of {BSD::Control::Context BSD::Control::Context}. + # Returns an instance of {BSD::Control::Context BSD::Control::Context} def self.context @context ||= BSD::Control::Context.new end ## # @return [String] - # Returns the version of libhbsdcontrol. + # Returns the version of libhbsdcontrol def self.library_version context.library_version end ## # @return [Array] - # Returns an array of available features. + # Returns an array of available features def self.available_features context.available_features end @@ -34,16 +34,16 @@ module BSD::Control # .enable!("/usr/local/bin/emacs-29.2") # # @param [String] name - # The name of a feature. + # The name of a feature # # @raise [BSD::Control::Error] - # When a feature is not found. + # When a feature wasn't found # # @return [BSD::Control::Feature] - # Returns an instance of {BSD::Control::Feature BSD::Control::Feature}. + # Returns an instance of {BSD::Control::Feature BSD::Control::Feature} def self.feature(name) feature = available_features.find { _1.name == name.to_s } - feature || raise(Error, "feature '#{name}' wasn't found") + feature || raise(Error, "'#{name}' wasn't found") end require_relative "control/context" diff --git a/lib/bsd/control/feature.rb b/lib/bsd/control/feature.rb index 73f7287..39bae37 100644 --- a/lib/bsd/control/feature.rb +++ b/lib/bsd/control/feature.rb @@ -4,7 +4,7 @@ module BSD::Control class Feature < Struct.new(:name, :context) ## # @return [Array] - # Returns an array of available features. + # Returns an array of available features def self.available BSD::Control.available_features end @@ -13,47 +13,47 @@ module BSD::Control # @group Actions ## - # Enables a feature for a given file. + # Enables a feature for a given file # # @param [String] path - # The path to a file. + # The path to a file # # @raise [SystemCallError] - # Might raise a number of Errno exceptions. + # Might raise a number of Errno exceptions # # @return [Boolean] - # Returns true on success. + # Returns true on success def enable!(path) set!(path, ENABLED) end ## - # Disables a feature for a given file. + # Disables a feature for a given file # # @param [String] path - # The path to a file. + # The path to a file # # @raise [SystemCallError] - # Might raise a number of Errno exceptions. + # Might raise a number of Errno exceptions # # @return [Boolean] - # Returns true on success. + # Returns true on success def disable!(path) set!(path, DISABLED) end ## # @!method sysdef!(path) - # Restores the system default for a given file. + # Restores the system default for a given file # # @param [String] path - # The path to a file. + # The path to a file # # @raise [SystemCallError] - # Might raise a number of Errno exceptions. + # Might raise a number of Errno exceptions # # @return [Boolean] - # Returns true on success. + # Returns true on success # @endgroup @@ -62,10 +62,10 @@ module BSD::Control ## # @param [String] path - # The path to a file. + # The path to a file # # @return [Boolean] - # Returns true when a feature is enabled for a given file. + # Returns true when a feature is enabled def enabled?(path) status(path) == :enabled end @@ -75,28 +75,28 @@ module BSD::Control # The path to a file. # # @return [Boolean] - # Returns true when a feature is disabled for a given file. + # Returns true when a feature is disabled def disabled?(path) status(path) == :disabled end ## # @param [String] path - # The path to a file. + # The path to a file # # @return [Boolean] - # Returns true when a feature is configured to use the system default. + # Returns true when the system default setting is used def sysdef?(path) status(path) == :sysdef end ## # @param [String] path - # The path to a file. + # The path to a file # # @return [Boolean] # Returns true when a feature is in an invalid state - # (eg: the feature is both enabled and disabled at the same time). + # (eg: the feature is both enabled and disabled at the same time) def invalid?(path) status(path) == :invalid end @@ -104,10 +104,10 @@ module BSD::Control ## # @!method status(path) # @param [String] path - # The path to a file. + # The path to a file # # @raise [SystemCallError] - # Might raise a number of Errno exceptions. + # Might raise a number of Errno exceptions # # @return [Symbol] # Returns the status of a feature for a given file. @@ -121,63 +121,63 @@ module BSD::Control ## # @return [Boolean] - # Returns true for the pageexec feature. + # Returns true for `pageexec` def pageexec? name == "pageexec" end ## # @return [Boolean] - # Returns true for the mprotect feature. + # Returns true for `mprotect` def mprotect? name == "mprotect" end ## # @return [Boolean] - # Returns true for the segv-guard feature. + # Returns true for `segvguard` def segvguard? name == "segvguard" end ## # @return [Boolean] - # Returns true for the ASLR feature. + # Returns true for `aslr` def aslr? name == "aslr" end ## # @return [Boolean] - # Returns true for the shlibrandom feature. + # Returns true for `shlibrandom` def shlibrandom? name == "shlibrandom" end ## # @return [Boolean] - # Returns true for the disallow-map32bit feature. + # Returns true for `disallow_map32bit` def disallow_map32bit? name == "disallow_map32bit" end ## # @return [Boolean] - # Returns true for the insecure kmod feature. + # Returns true for `insecure_kmod` def insecure_kmod? name == "insecure_kmod" end ## # @return [Boolean] - # Returns true for the harden SHM feature. + # Returns true for `harden_shm` def harden_shm? name == "harden_shm" end ## # @return [Boolean] - # Returns true for the prohibit ptrace capsicum feature. + # Returns true for `prohibit_ptrace_capsicum` def prohibit_ptrace_capsicum? name == "prohibit_ptrace_capsicum" end