Class: Unleash::Incognia::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/unleash/incognia/client.rb

Instance Method Summary collapse

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_featuresObject



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

Returns:

  • (Boolean)


9
10
11
# File 'lib/unleash/incognia/client.rb', line 9

def feature_enabled?(name)
  client.is_enabled? name, context
end