Skip to content

Commit 9dc2db5

Browse files
committed
Extract filter logic (allow/disallow) options given a hash
1 parent ffc15d2 commit 9dc2db5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/meilisearch/utils.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ def self.parse(body)
2323
end
2424
end
2525

26+
def self.filter(original_options, allowed_params = [])
27+
original_options.transform_keys(&:to_sym).slice(*allowed_params)
28+
end
29+
2630
def self.parse_query(original_options, allowed_params = [])
27-
only_allowed_params = original_options.transform_keys(&:to_sym).slice(*allowed_params)
31+
only_allowed_params = filter(original_options, allowed_params)
2832

2933
Utils.transform_attributes(only_allowed_params).then do |body|
3034
body.transform_values do |v|

0 commit comments

Comments
 (0)