class OpenFeature::Client
- OpenFeature::Client
- Reference
- Object
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.cropenfeature/event.cr
openfeature/hook.cr
openfeature/hooks/proc.cr
Constructors
Instance Method Summary
-
#add_handler(event : ProviderEvent, &handler : Handler)
add the handler to the client for the given event
-
#add_hook(h : Hook)
add the passed hook
-
#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
- #boolean_details(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
- #boolean_value(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Bool
- #evaluation_context : EvaluationContext
- #handlers : Hash(OpenFeature::ProviderEvent, Array(OpenFeature::EventDetails -> Nil))
- #hooks : Array(OpenFeature::Hook)
- #metadata : Metadata
- #number_details(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
- #number_value(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Number
- #object_details(flag_key : FlagKey, default : Structure = nil, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil)
- #object_value(flag_key : FlagKey, default : Structure, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Structure
- #provider : Provider
-
#remove_handler(event : ProviderEvent, &handler : Handler)
remove the handler from the client for the given event
-
#remove_hook(h : Hook)
remove the passed hook
- #string_details(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
- #string_value(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : String
Constructor Detail
def self.new(provider : Provider, *, evaluation_context ectx : EvaluationContext | Nil = nil, metadata md : Metadata | Nil = nil)
#
Instance Method Detail
add the handler to the client for the given event
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
def boolean_details(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
#
def boolean_value(flag_key : FlagKey, default : Bool = true, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Bool
#
def number_details(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
#
def number_value(flag_key : FlagKey, default : Number = 0, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Number
#
def object_details(flag_key : FlagKey, default : Structure = nil, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil)
#
def object_value(flag_key : FlagKey, default : Structure, *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : Structure
#
remove the handler from the client for the given event
def string_details(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : FlagEvaluationDetails
#
def string_value(flag_key : FlagKey, default : String = "", *, context ctx : EvaluationContext | Nil = nil, options : EvaluationOptions | Nil = nil) : String
#