Sha256: fc55021972d576bcd8cb8f680259f2a8f3b0daaeee666830710099d7dcdfd747

Contents?: true

Size: 777 Bytes

Versions: 3

Compression:

Stored size: 777 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module OpenFeature
  # Represents full set of hooks with helper methods for filtering and sequencing each subtype
  class Hooks < T::Struct
    extend T::Generic
    extend T::Sig
    const :global, T::Array[Hook], default: []
    const :provider, T::Array[Hook], default: []
    const :client, T::Array[Hook], default: []
    const :invocation, T::Array[Hook], default: []

    # See Requirement 4.4.2
    # TODO: when there is >1 subtype of hook will need to filter and not simply re-cast
    #   ACHTUNG! T.cast is safe for now but will need to be updated after ^
    sig { returns(T::Array[Hook::BeforeHook]) }
    def before
      T.cast(global + client + invocation + provider, T::Array[Hook::BeforeHook])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openfeature-sdk-sorbet-0.4.0 lib/open_feature/hooks.rb
openfeature-sdk-sorbet-0.3.1 lib/open_feature/hooks.rb
openfeature-sdk-sorbet-0.3.0 lib/open_feature/hooks.rb