Method: Determinator::Feature#initialize
- Defined in:
- lib/determinator/feature.rb
#initialize(name:, identifier:, bucket_type:, target_groups:, structured_bucket: nil, fixed_determinations: [], variants: {}, overrides: {}, active: false, winning_variant: nil) ⇒ Feature
Returns a new instance of Feature.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/determinator/feature.rb', line 8 def initialize(name:, identifier:, bucket_type:, target_groups:, structured_bucket: nil, fixed_determinations: [], variants: {}, overrides: {}, active: false, winning_variant: nil) @name = name.to_s @identifier = identifier.to_s @variants = variants @target_groups = parse_target_groups(target_groups) @fixed_determinations = parse_fixed_determinations(fixed_determinations) @winning_variant = parse_outcome(winning_variant, allow_exclusion: false) @active = active @bucket_type = bucket_type.to_sym @structured_bucket = structured_bucket # To prevent confusion between actor id data types @overrides = overrides.each_with_object({}) do |(identifier, outcome), hash| parsed = parse_outcome(outcome, allow_exclusion: true) hash[identifier.to_s] = parsed unless parsed.nil? end end |