lib/unleash/feature_toggle.rb in unleash-5.0.0 vs lib/unleash/feature_toggle.rb in unleash-5.0.1
- old
+ new
@@ -187,11 +187,11 @@
end
context
end
def initialize_strategies(params, segment_map)
- params.fetch('strategies', [])
+ (params.fetch('strategies', []) || [])
.select{ |s| s.has_key?('name') && Unleash.strategies.includes?(s['name']) }
.map do |s|
ActivationStrategy.new(
s['name'],
s['parameters'],
@@ -200,10 +200,10 @@
)
end || []
end
def resolve_variants(strategy)
- strategy.fetch("variants", [])
+ (strategy.fetch("variants", []) || [])
.select{ |variant| variant.is_a?(Hash) && variant.has_key?("name") }
.map do |variant|
VariantDefinition.new(
variant.fetch("name", ""),
variant.fetch("weight", 0),