Sha256: 63687fc3bf71744844edd0a7252ec8d5db40427b98f05d191cb417f2190a1a11
Contents?: true
Size: 1.09 KB
Versions: 17
Compression:
Stored size: 1.09 KB
Contents
module GraphitiGraphQL module GraphitiSchema class Sideload attr_reader :config, :schema attr_accessor :name def initialize(schema, config) @config = config @schema = schema end def graphql_class_name if type == :polymorphic_belongs_to parent_resource.graphql_class_name else resource.graphql_class_name end end def to_many? [:has_many, :many_to_many].include?(type) end def type config[:type].to_sym end def resource_name config[:resource] end def resource schema.get_resource(resource_name) end def remote? resources = child_resources? ? child_resources : [resource] resources.any?(&:remote?) end def parent_resource schema.get_resource(config[:parent_resource]) end def child_resources? !!config[:resources] end def child_resources config[:resources].map do |name| schema.get_resource(name) end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems