Class: ActiveShopifyGraphQL::SearchQuery::ParameterBinder

Inherits:
Object
  • Object
show all
Defined in:
lib/active_shopify_graphql/search_query/parameter_binder.rb

Overview

Binds parameters to string queries with proper sanitization Supports both positional (?) and named (:param) placeholders

Class Method Summary collapse

Class Method Details

.bind(query_string, *args) ⇒ String

Binds parameters to a query string

Parameters:

  • The query with placeholders

  • Positional arguments or a hash of named parameters

Returns:

  • The query with bound and escaped parameters



14
15
16
17
18
19
20
21
22
# File 'lib/active_shopify_graphql/search_query/parameter_binder.rb', line 14

def self.bind(query_string, *args)
  return query_string if args.empty?

  if args.first.is_a?(Hash)
    bind_named_parameters(query_string, args.first)
  else
    bind_positional_parameters(query_string, args)
  end
end