Sha256: 6f51354678702e38aea6ae1a0fbf218a02c472aba66491c4c1a62693db885312

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 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(callback_members, 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

      def callback_members
        members - [:flags]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffi-libfuse-0.0.1.rctest12 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.0.1.rctest11 lib/ffi/libfuse/fuse_callbacks.rb
ffi-libfuse-0.0.1.pre lib/ffi/libfuse/fuse_callbacks.rb