diff --git a/lib/dato_cms_graphql.rb b/lib/dato_cms_graphql.rb index 529718d..ebc81ba 100644 --- a/lib/dato_cms_graphql.rb +++ b/lib/dato_cms_graphql.rb @@ -54,7 +54,7 @@ def self.queries raise "\"#{@path_to_queries}\" does not exist" unless File.exist?(@path_to_queries) Dir[File.join(@path_to_queries, "*.rb")].sort.each { require(_1) } - ObjectSpace.each_object(::Class).select { |klass| klass < DatoCmsGraphql::GraphqlBase } + ObjectSpace.each_object(::Class).select { |klass| klass < DatoCmsGraphql::GraphqlBase }.uniq(&:name) end def self.path_to_queries=(value) diff --git a/lib/dato_cms_graphql/graphql_base.rb b/lib/dato_cms_graphql/graphql_base.rb index 5e8013b..018d149 100644 --- a/lib/dato_cms_graphql/graphql_base.rb +++ b/lib/dato_cms_graphql/graphql_base.rb @@ -34,7 +34,7 @@ def initialize_queries end def query_name - name.gsub("Query", "") + name.split("::").last.gsub("Query", "") end def plural_name diff --git a/lib/dato_cms_graphql/version.rb b/lib/dato_cms_graphql/version.rb index d5e172a..ba2cee3 100644 --- a/lib/dato_cms_graphql/version.rb +++ b/lib/dato_cms_graphql/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module DatoCmsGraphql - VERSION = "0.2.1" + VERSION = "0.2.2" end