summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/markdown_field/resolver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/graphql/markdown_field/resolver.rb')
-rw-r--r--lib/gitlab/graphql/markdown_field/resolver.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/markdown_field/resolver.rb b/lib/gitlab/graphql/markdown_field/resolver.rb
new file mode 100644
index 00000000000..11a01b95ad1
--- /dev/null
+++ b/lib/gitlab/graphql/markdown_field/resolver.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module MarkdownField
+ class Resolver
+ attr_reader :method_name
+
+ def initialize(method_name)
+ @method_name = method_name
+ end
+
+ def proc
+ -> (object, _args, ctx) do
+ # We need to `dup` the context so the MarkdownHelper doesn't modify it
+ ::MarkupHelper.markdown_field(object, method_name, ctx.to_h.dup)
+ end
+ end
+ end
+ end
+ end
+end