Test for Pruner
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
module Pruning
|
||||
module HTTP
|
||||
# Whitelists the URL query parameters
|
||||
class Query < Struct.new(:name, :indicator_ids)
|
||||
def initialize(params = {})
|
||||
symbolised = params.map { |k, v| { k.to_sym => v } }.reduce({}, :merge)
|
||||
@@ -7,9 +8,9 @@ module Pruning
|
||||
value = symbolised.fetch(member, nil)
|
||||
next if value.nil?
|
||||
case member
|
||||
when :indicator_ids then value.map(&->(indicator_id) { indicator_id.to_i } ) # break on purpose if indicator_ids is not an array
|
||||
when :name then value.to_s.gsub(/[^A-Za-z]/,'')
|
||||
else value
|
||||
when :indicator_ids then value.map(&->(indicator_id) { indicator_id.to_i }) # break on purpose if indicator_ids is not an array
|
||||
when :name then value.to_s.gsub(/[^A-Za-z]/, '')
|
||||
else value
|
||||
end
|
||||
end
|
||||
super(*values)
|
||||
|
||||
Reference in New Issue
Block a user