Class: ActionPolicy::GraphQL::AuthorizedField::ScopeExtension

Inherits:
Extension
  • Object
show all
Defined in:
lib/action_policy/graphql/authorized_field.rb

Instance Method Summary collapse

Methods inherited from Extension

#extract_option

Instance Method Details

#resolve(context:, object:, arguments:, **_rest) ⇒ Object



117
118
119
120
121
122
# File 'lib/action_policy/graphql/authorized_field.rb', line 117

def resolve(context:, object:, arguments:, **_rest)
  value = yield(object, arguments)
  return value if value.nil?

  object.authorized_scope(value, **options)
end