Class: Kameleoon::Configuration::MEGroup
- Inherits:
-
Object
- Object
- Kameleoon::Configuration::MEGroup
- Defined in:
- lib/kameleoon/configuration/me_group.rb
Instance Attribute Summary collapse
-
#feature_flags ⇒ Object
readonly
Returns the value of attribute feature_flags.
Instance Method Summary collapse
- #get_feature_flag_by_hash(hash) ⇒ Object
-
#initialize(feature_flags) ⇒ MEGroup
constructor
A new instance of MEGroup.
Constructor Details
#initialize(feature_flags) ⇒ MEGroup
Returns a new instance of MEGroup.
8 9 10 |
# File 'lib/kameleoon/configuration/me_group.rb', line 8 def initialize(feature_flags) @feature_flags = feature_flags.sort { |a, b| a.id <=> b.id } end |
Instance Attribute Details
#feature_flags ⇒ Object (readonly)
Returns the value of attribute feature_flags.
6 7 8 |
# File 'lib/kameleoon/configuration/me_group.rb', line 6 def feature_flags @feature_flags end |
Instance Method Details
#get_feature_flag_by_hash(hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/kameleoon/configuration/me_group.rb', line 12 def get_feature_flag_by_hash(hash) idx = (hash * @feature_flags.size).to_i idx = @feature_flags.size - 1 if idx >= @feature_flags.size @feature_flags[idx] end |