Class: Kameleoon::Types::FeatureFlag
- Inherits:
-
Object
- Object
- Kameleoon::Types::FeatureFlag
- Defined in:
- lib/kameleoon/types/feature_flag.rb
Overview
FeatureFlag
Instance Attribute Summary collapse
-
#default_variation_key ⇒ Object
readonly
Returns the value of attribute default_variation_key.
-
#environment_enabled ⇒ Object
readonly
Returns the value of attribute environment_enabled.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
-
#variations ⇒ Object
readonly
Returns the value of attribute variations.
Class Method Summary collapse
Instance Method Summary collapse
- #default_variation ⇒ Object
-
#initialize(variations, environment_enabled, rules, default_variation_key) ⇒ FeatureFlag
constructor
private
A new instance of FeatureFlag.
- #to_s ⇒ Object
Constructor Details
#initialize(variations, environment_enabled, rules, default_variation_key) ⇒ FeatureFlag
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FeatureFlag.
13 14 15 16 17 18 |
# File 'lib/kameleoon/types/feature_flag.rb', line 13 def initialize(variations, environment_enabled, rules, default_variation_key) @variations = variations @environment_enabled = environment_enabled @rules = rules @default_variation_key = default_variation_key end |
Instance Attribute Details
#default_variation_key ⇒ Object (readonly)
Returns the value of attribute default_variation_key.
10 11 12 |
# File 'lib/kameleoon/types/feature_flag.rb', line 10 def default_variation_key @default_variation_key end |
#environment_enabled ⇒ Object (readonly)
Returns the value of attribute environment_enabled.
10 11 12 |
# File 'lib/kameleoon/types/feature_flag.rb', line 10 def environment_enabled @environment_enabled end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
10 11 12 |
# File 'lib/kameleoon/types/feature_flag.rb', line 10 def rules @rules end |
#variations ⇒ Object (readonly)
Returns the value of attribute variations.
10 11 12 |
# File 'lib/kameleoon/types/feature_flag.rb', line 10 def variations @variations end |
Class Method Details
._build_from_internal(source_feature_flag) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/kameleoon/types/feature_flag.rb', line 25 def self._build_from_internal(source_feature_flag) variations = (source_feature_flag.variations || []).each_with_object({}) do |variation, result| ext_variation = Variation._build_from_internal(variation) result[ext_variation.key] = ext_variation end rules = (source_feature_flag.rules || []).map do |rule| Rule._build_from_internal(rule, variations) end FeatureFlag.new( variations, source_feature_flag.environment_enabled, rules, source_feature_flag.default_variation_key ) end |
Instance Method Details
#default_variation ⇒ Object
20 21 22 |
# File 'lib/kameleoon/types/feature_flag.rb', line 20 def default_variation @variations[@default_variation_key] end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/kameleoon/types/feature_flag.rb', line 43 def to_s "FeatureFlag{variations:#{@variations},environment_enabled:#{@environment_enabled},rules:#{@rules},default_variation_key:#{@default_variation_key}}" end |