Class: Unleash::Incognia::Client
- Inherits:
-
Object
- Object
- Unleash::Incognia::Client
- Defined in:
- lib/unleash/incognia/client.rb
Instance Method Summary collapse
- #enabled_features ⇒ Object
- #feature_enabled?(name) ⇒ Boolean
-
#initialize(user:, organization: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(user:, organization: nil) ⇒ Client
Returns a new instance of Client.
4 5 6 7 |
# File 'lib/unleash/incognia/client.rb', line 4 def initialize(user:, organization: nil) @user = user @organization = organization end |
Instance Method Details
#enabled_features ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/unleash/incognia/client.rb', line 13 def enabled_features feature_flags_names = Unleash.toggles.map do |feature_flag| feature_flag['name'] end feature_flags_names.select { |name| feature_enabled?(name) } end |
#feature_enabled?(name) ⇒ Boolean
9 10 11 |
# File 'lib/unleash/incognia/client.rb', line 9 def feature_enabled?(name) client.is_enabled? name, context end |