Class: GraphQL::Decorate::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/decorate/metadata.rb

Overview

Contains methods to evaluate different types of metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetadata

Returns a new instance of Metadata.



13
14
15
16
# File 'lib/graphql/decorate/metadata.rb', line 13

def initialize
  @unscoped_proc = nil
  @scoped_proc = nil
end

Instance Attribute Details

#scoped_procProc (readonly)

Returns:

  • (Proc)


11
12
13
# File 'lib/graphql/decorate/metadata.rb', line 11

def scoped_proc
  @scoped_proc
end

#unscoped_procProc (readonly)

Returns:

  • (Proc)


8
9
10
# File 'lib/graphql/decorate/metadata.rb', line 8

def unscoped_proc
  @unscoped_proc
end

Instance Method Details

#scoped {|object, graphql_context| ... } ⇒ Object

Yields:

  • (object, graphql_context)

    Evaluate metadata for a resolved field and all child fields



24
25
26
# File 'lib/graphql/decorate/metadata.rb', line 24

def scoped(&block)
  @scoped_proc = block
end

#unscoped {|object, graphql_context| ... } ⇒ Object

Yields:

  • (object, graphql_context)

    Evaluate metadata for a single resolved field



19
20
21
# File 'lib/graphql/decorate/metadata.rb', line 19

def unscoped(&block)
  @unscoped_proc = block
end