Sha256: 6d7cf26e4fe0594cef16250b00f83054721b9aed3fe46407cb62ff479412316e

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require_relative 'callbacks'

module FFI
  module Libfuse
    # Methods to register callbacks and wrappers
    module FuseCallbacks
      include Callbacks

      # @!group Configuration

      # @!method fuse_wrappers(*wrappers)
      #  @abstract
      #  Wrappers change the behaviour/signature of the abstract fuse callback methods
      #
      #  @param [Array] wrappers
      #    An initial list of wrappers
      #  @return [Array] the final list of wrappers.
      #    Implementations should append or prepend to the input wrappers as appropriate
      #
      #    See {register} for what constitutes a valid wrapper

      # @!method fuse_respond_to?(fuse_method)
      #   @abstract
      #   @param [Symbol] fuse_method a fuse callback method
      #   @return [Boolean] true if the fuse method should be registered

      # @!endgroup
      private

      def initialize_callbacks(delegate:, wrappers: [])
        wrappers = delegate.fuse_wrappers(*wrappers) if delegate.respond_to?(:fuse_wrappers)
        super(fuse_callbacks, delegate: delegate, wrappers: wrappers)
      end

      def respond_to_callback?(method, delegate)
        return delegate.fuse_respond_to?(method) if delegate.respond_to?(:fuse_respond_to?)

        super
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffi-libfuse-0.4.1 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.4.0 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.3.4 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.3.3 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.1.0.rc20220550 lib/ffi/libfuse/fuse_callbacks.rb