Class: GraphqlRails::DumpGraphqlSchemas

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_rails/tasks/dump_graphql_schemas.rb

Overview

Generates graphql schema dump files

Defined Under Namespace

Classes: MissingGraphqlRouterError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dump_dir:, groups: nil) ⇒ DumpGraphqlSchemas

Returns a new instance of DumpGraphqlSchemas.



16
17
18
19
# File 'lib/graphql_rails/tasks/dump_graphql_schemas.rb', line 16

def initialize(dump_dir:, groups: nil)
  @groups = groups.presence
  @dump_dir = dump_dir
end

Class Method Details

.call(**args) ⇒ Object



12
13
14
# File 'lib/graphql_rails/tasks/dump_graphql_schemas.rb', line 12

def self.call(**args)
  new(**args).call
end

Instance Method Details

#callObject



21
22
23
24
25
26
# File 'lib/graphql_rails/tasks/dump_graphql_schemas.rb', line 21

def call
  validate
  return dump_default_schema if groups.empty?

  groups.each { |group| dump_graphql_schema(group) }
end