Class: Gitlab::Graphql::MarkdownField::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/graphql/markdown_field/resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name) ⇒ Resolver

Returns a new instance of Resolver.


9
10
11
# File 'lib/gitlab/graphql/markdown_field/resolver.rb', line 9

def initialize(method_name)
  @method_name = method_name
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name


7
8
9
# File 'lib/gitlab/graphql/markdown_field/resolver.rb', line 7

def method_name
  @method_name
end

Instance Method Details

#procObject


13
14
15
16
17
18
# File 'lib/gitlab/graphql/markdown_field/resolver.rb', line 13

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