Sha256: 2ae69896eae3bc7d152449b91c7616d313c1d6f0b6b7f549e4e0df4fd92ff7e4

Contents?: true

Size: 1.05 KB

Versions: 20

Compression:

Stored size: 1.05 KB

Contents

# https://robots.thoughtbot.com/mygem-configure-block
module Graphiti
  class Configuration
    # @return [Boolean] Should we raise when the client requests a relationship not defined on the server?
    #   Defaults to true.
    attr_accessor :raise_on_missing_sideload
    # @return [Boolean] Concurrently fetch sideloads?
    #   Defaults to false OR if classes are cached (Rails-only)
    attr_accessor :concurrency

    attr_accessor :respond_to
    attr_accessor :context_for_endpoint
    attr_accessor :schema_path
    attr_accessor :links_on_demand
    attr_accessor :typecast_reads

    # Set defaults
    # @api private
    def initialize
      @raise_on_missing_sideload = true
      @concurrency = false
      @respond_to = [:json, :jsonapi, :xml]
      @links_on_demand = false
      @typecast_reads = true

      if defined?(::Rails)
        @schema_path = "#{::Rails.root}/public/schema.json"
      end
    end

    def schema_path
      @schema_path ||= raise('No schema_path defined! Set Graphiti.config.schema_path to save your schema.')
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
graphiti-1.0.beta.5 lib/graphiti/configuration.rb
graphiti-1.0.beta.4 lib/graphiti/configuration.rb
graphiti-1.0.beta.3 lib/graphiti/configuration.rb
graphiti-1.0.beta.2 lib/graphiti/configuration.rb
graphiti-1.0.alpha.26 lib/graphiti/configuration.rb
graphiti-1.0.alpha.25 lib/graphiti/configuration.rb
graphiti-1.0.alpha.24 lib/graphiti/configuration.rb
graphiti-1.0.alpha.23 lib/graphiti/configuration.rb
graphiti-1.0.alpha.22 lib/graphiti/configuration.rb
graphiti-1.0.alpha.21 lib/graphiti/configuration.rb
graphiti-1.0.alpha.20 lib/graphiti/configuration.rb
graphiti-1.0.alpha.19 lib/graphiti/configuration.rb
graphiti-1.0.alpha.18 lib/graphiti/configuration.rb
graphiti-1.0.alpha.17 lib/graphiti/configuration.rb
graphiti-1.0.alpha.16 lib/graphiti/configuration.rb
graphiti-1.0.alpha.15 lib/graphiti/configuration.rb
graphiti-1.0.alpha.14 lib/graphiti/configuration.rb
graphiti-1.0.alpha.12 lib/graphiti/configuration.rb
graphiti-1.0.alpha.11 lib/graphiti/configuration.rb
graphiti-1.0.alpha.10 lib/graphiti/configuration.rb