lib/field_test/experiment.rb in field_test-0.5.4 vs lib/field_test/experiment.rb in field_test-0.5.5
- old
+ new
@@ -6,9 +6,14 @@
attributes = attributes.symbolize_keys
@id = attributes[:id]
@name = attributes[:name] || @id.to_s.titleize
@description = attributes[:description]
@variants = attributes[:variants]
+ if @variants.any? { |v| !v.is_a?(String) }
+ # TODO add support for more types (including query parameters)
+ # or raise error in 0.6
+ warn "[field_test] Only string variants are supported (#{id})"
+ end
@weights = @variants.size.times.map { |i| attributes[:weights].to_a[i] || 1 }
@winner = attributes[:winner]
@closed = attributes[:closed]
@keep_variant = attributes[:keep_variant]
@started_at = Time.zone.parse(attributes[:started_at].to_s) if attributes[:started_at]