Sha256: 6323aa3a18b1a49292ef44bfb4ac58512e9d5f1adad4252795c951fa7c0c41a6
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require "active_support/core_ext/object/json" require "graphiti_graphql/version" require "graphiti_graphql/graphiti_schema/wrapper" require "graphiti_graphql/graphiti_schema/sideload" require "graphiti_graphql/graphiti_schema/resource" require "graphiti_graphql/errors" require "graphiti_graphql/schema" require "graphiti_graphql/runner" require "graphiti_graphql/util" Graphiti.class_eval do class << self attr_writer :graphql_schema end # TODO probably move these off of Graphiti def self.gql(query, variables) runner = ::GraphitiGraphQL::Runner.new runner.execute(query, variables, graphql_schema.schema) end def self.graphql_schema @graphql_schema ||= GraphitiGraphQL::Schema.generate end def self.graphql_schema? !!@graphql_schema end def self.graphql_schema!(entrypoint_resources = nil) @graphql_schema = GraphitiGraphQL::Schema.generate(entrypoint_resources) end end module GraphitiGraphQL class Error < StandardError; end class Configuration attr_accessor :schema_reloading def initialize self.schema_reloading = true end end class << self attr_accessor :schema_class end def self.config @config ||= Configuration.new end def self.define_context(&blk) @define_context = blk end def self.get_context obj = Graphiti.context[:object] if @define_context @define_context.call(obj) else {object: obj} end end end if defined?(::Rails) require "graphiti_graphql/engine" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
graphiti_graphql-0.1.0 | lib/graphiti_graphql.rb |