@@ -594,37 +594,6 @@ def rollout_experiment?(experiment_id)
594594 @rollout_experiment_id_map . key? ( experiment_id )
595595 end
596596
597- private
598-
599- def generate_feature_variation_map ( feature_flags )
600- flag_variation_map = { }
601- feature_flags . each do |flag |
602- variations = [ ]
603- get_rules_for_flag ( flag ) . each do |rule |
604- rule [ 'variations' ] . each do |rule_variation |
605- variations . push ( rule_variation ) if variations . select { |variation | variation [ 'id' ] == rule_variation [ 'id' ] } . empty?
606- end
607- end
608- flag_variation_map [ flag [ 'key' ] ] = variations
609- end
610- flag_variation_map
611- end
612-
613- def generate_key_map ( array , key , first_value : false )
614- # Helper method to generate map from key to hash in array of hashes
615- #
616- # array - Array consisting of hash
617- # key - Key in each hash which will be key in the map
618- # first_value - Determines which value to save if there are duplicate keys. By default the last instance of the key
619- # will be saved. Set to true to save the first key/value encountered.
620- #
621- # Returns map mapping key to hash
622-
623- array
624- . group_by { |obj | obj [ key ] }
625- . transform_values { |group | first_value ? group . first : group . last }
626- end
627-
628597 def get_holdouts_for_flag ( flag_key )
629598 # Helper method to get holdouts from an applied feature flag
630599 #
@@ -678,5 +647,36 @@ def get_holdout(holdout_id)
678647 @logger . log Logger ::ERROR , "Holdout with ID '#{ holdout_id } ' not found."
679648 nil
680649 end
650+
651+ private
652+
653+ def generate_feature_variation_map ( feature_flags )
654+ flag_variation_map = { }
655+ feature_flags . each do |flag |
656+ variations = [ ]
657+ get_rules_for_flag ( flag ) . each do |rule |
658+ rule [ 'variations' ] . each do |rule_variation |
659+ variations . push ( rule_variation ) if variations . select { |variation | variation [ 'id' ] == rule_variation [ 'id' ] } . empty?
660+ end
661+ end
662+ flag_variation_map [ flag [ 'key' ] ] = variations
663+ end
664+ flag_variation_map
665+ end
666+
667+ def generate_key_map ( array , key , first_value : false )
668+ # Helper method to generate map from key to hash in array of hashes
669+ #
670+ # array - Array consisting of hash
671+ # key - Key in each hash which will be key in the map
672+ # first_value - Determines which value to save if there are duplicate keys. By default the last instance of the key
673+ # will be saved. Set to true to save the first key/value encountered.
674+ #
675+ # Returns map mapping key to hash
676+
677+ array
678+ . group_by { |obj | obj [ key ] }
679+ . transform_values { |group | first_value ? group . first : group . last }
680+ end
681681 end
682682end
0 commit comments