Method: GraphQL::Schema::Directive.locations

Defined in:
lib/graphql/schema/directive.rb

.locations(*new_locations) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/graphql/schema/directive.rb', line 32

def locations(*new_locations)
  if !new_locations.empty?
    new_locations.each do |new_loc|
      if !LOCATIONS.include?(new_loc.to_sym)
        raise ArgumentError, "#{self} (#{self.graphql_name}) has an invalid directive location: `locations #{new_loc}` "
      end
    end
    @locations = new_locations
  else
    @locations ||= (superclass.respond_to?(:locations) ? superclass.locations : [])
  end
end