Class: KittyPolicy::GraphQL::AssignFallbackKey

Inherits:
Object
  • Object
show all
Defined in:
lib/kitty_policy/graphql/field_authorization.rb

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ AssignFallbackKey

Returns a new instance of AssignFallbackKey.



78
79
80
# File 'lib/kitty_policy/graphql/field_authorization.rb', line 78

def initialize(key)
  @key = key
end

Instance Method Details

#call(defn, value = []) ⇒ Object

NOTE(rstankov): This is needed because when we have empty array([]) as fallback internally graphql-ruby does a *args and this loses the empty array



84
85
86
# File 'lib/kitty_policy/graphql/field_authorization.rb', line 84

def call(defn, value = [])
  defn.[@key] = value
end