Module: Sanity

Defined in:
lib/sanity.rb,
lib/sanity/http.rb,
lib/sanity/groqify.rb,
lib/sanity/version.rb,
lib/sanity/resource.rb,
lib/sanity/http/find.rb,
lib/sanity/mutatable.rb,
lib/sanity/queryable.rb,
lib/sanity/groq/order.rb,
lib/sanity/groq/slice.rb,
lib/sanity/http/patch.rb,
lib/sanity/http/query.rb,
lib/sanity/http/where.rb,
lib/sanity/groq/filter.rb,
lib/sanity/groq/select.rb,
lib/sanity/http/create.rb,
lib/sanity/http/delete.rb,
lib/sanity/publishable.rb,
lib/sanity/attributable.rb,
lib/sanity/http/publish.rb,
lib/sanity/http/results.rb,
lib/sanity/serializable.rb,
lib/sanity/configuration.rb,
lib/sanity/http/mutation.rb,
lib/sanity/http/unpublish.rb,
lib/sanity/resources/asset.rb,
lib/sanity/http/publication.rb,
lib/sanity/refinements/arrays.rb,
lib/sanity/refinements/hashes.rb,
lib/sanity/resources/document.rb,
lib/sanity/helpers/type_helper.rb,
lib/sanity/refinements/strings.rb,
lib/sanity/http/create_or_replace.rb,
lib/sanity/http/create_if_not_exists.rb

Defined Under Namespace

Modules: Attributable, Groq, Http, Mutatable, Publishable, Queryable, Refinements, Serializable, TypeHelper Classes: Asset, Configuration, Document, Error, Groqify, Resource

Constant Summary collapse

RESULT_WRAPPER_DEPRECATION_WARNING =
"DEPRECATION: `result_wrapper` is deprecated. Please use `serializer` instead."
VERSION =
"0.6.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.use_global_configObject

Returns the value of attribute use_global_config.



41
42
43
# File 'lib/sanity/configuration.rb', line 41

def use_global_config
  @use_global_config
end

Class Method Details

.configurationObject Also known as: config



43
44
45
46
47
48
49
# File 'lib/sanity/configuration.rb', line 43

def configuration
  if use_global_config
    @configuration ||= Configuration.new
  else
    Thread.current[:sanity_configuration] ||= Configuration.new
  end
end

.configuration=(config) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/sanity/configuration.rb', line 52

def configuration=(config)
  if use_global_config
    @configuration = config
  else
    Thread.current[:sanity_configuration] = config
  end
end

.configure {|configuration| ... } ⇒ Object

Yields:



60
61
62
# File 'lib/sanity/configuration.rb', line 60

def configure
  yield configuration
end