Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/graphql/find_argument_in_parent.rb')
-rw-r--r--lib/gitlab/graphql/find_argument_in_parent.rb32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/gitlab/graphql/find_argument_in_parent.rb b/lib/gitlab/graphql/find_argument_in_parent.rb
deleted file mode 100644
index 1f83f8fce7a..00000000000
--- a/lib/gitlab/graphql/find_argument_in_parent.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Graphql
- module FindArgumentInParent
- # Searches up the GraphQL AST and returns the first matching argument
- # passed to a node
- def self.find(parent, argument, limit_depth: nil)
- argument = argument.to_s.camelize(:lower).to_sym
- depth = 0
-
- while parent.respond_to?(:parent)
- args = node_args(parent)
- return args[argument] if args.key?(argument)
-
- depth += 1
- return if limit_depth && depth >= limit_depth
-
- parent = parent.parent
- end
- end
-
- class << self
- private
-
- def node_args(node)
- node.irep_node.arguments
- end
- end
- end
- end
-end