class OpenFeature::Client

Overview

A lightweight abstraction that provides functions to evaluate feature flags. A client is associated with a single provider, which it uses to perform evaluations.

Defined in:

openfeature/client.cr
openfeature/event.cr
openfeature/hook.cr
openfeature/hooks/proc.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(provider : Provider, *, evaluation_context ectx : EvaluationContext | Nil = nil, metadata md : Metadata | Nil = nil) #

[View source]

Instance Method Detail

def add_handler(event : ProviderEvent, &handler : Handler) #

add the handler to the client for the given event


[View source]
def add_hook(h : Hook) #

add the passed hook


[View source]
def add_proc_hook(*, before : BeforeStageHook | Nil = nil, after : AfterStageHook | Nil = nil, error : ErrorStageHook | Nil = nil, finally : FinallyStageHook | Nil = nil) #

Add proc based hook to client hooks


[View source]
def boolean_details(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails #

[View source]
def boolean_value(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Bool #

[View source]
def evaluation_context : EvaluationContext #

[View source]
def handlers : Hash(OpenFeature::ProviderEvent, Array(OpenFeature::EventDetails -> Nil)) #

[View source]
def hooks : Array(OpenFeature::Hook) #

[View source]
def metadata : Metadata #

[View source]
def number_details(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails #

[View source]
def number_value(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Number #

[View source]
def object_details(flag_key : FlagKey, default : Structure = nil, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) #

[View source]
def object_value(flag_key : FlagKey, default : Structure, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Structure #

[View source]
def provider : Provider #

[View source]
def remove_handler(event : ProviderEvent, &handler : Handler) #

remove the handler from the client for the given event


[View source]
def remove_hook(h : Hook) #

remove the passed hook


[View source]
def string_details(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails #

[View source]
def string_value(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : String #

[View source]