Module: Valkyrie

Defined in:
lib/valkyrie/engine.rb,
lib/valkyrie.rb,
lib/valkyrie/id.rb,
lib/valkyrie/types.rb,
lib/valkyrie/storage.rb,
lib/valkyrie/version.rb,
lib/valkyrie/resource.rb,
lib/valkyrie/change_set.rb,
lib/valkyrie/persistence.rb,
lib/valkyrie/value_mapper.rb,
lib/valkyrie/storage_adapter.rb,
lib/valkyrie/metadata_adapter.rb,
lib/valkyrie/adapter_container.rb,
lib/valkyrie/specs/shared_specs.rb,
lib/valkyrie/resource/access_controls.rb

Overview

don’t use it, please.

Defined Under Namespace

Modules: Indexers, Persistence, Specs, Storage, Types, Vocab Classes: AdapterContainer, ChangeSet, Config, Engine, ID, MetadataAdapter, Resource, ResourceGenerator, StorageAdapter, ValueMapper

Constant Summary collapse

VERSION =
"1.6.0"

Class Method Summary collapse

Class Method Details

.configObject



34
35
36
37
38
# File 'lib/valkyrie.rb', line 34

def config
  @config ||= Config.new(
    config_hash
  )
end

.config_fileObject



40
41
42
43
# File 'lib/valkyrie.rb', line 40

def config_file
  return unless File.exist?(config_root_path.join("config", "valkyrie.yml"))
  File.read(config_root_path.join("config", "valkyrie.yml"))
end

.config_hashObject



45
46
47
48
# File 'lib/valkyrie.rb', line 45

def config_hash
  return {} unless config_file
  YAML.safe_load(ERB.new(config_file).result)[environment]
end

.config_root_pathObject



58
59
60
61
62
63
64
# File 'lib/valkyrie.rb', line 58

def config_root_path
  if const_defined?(:Rails) && Rails.respond_to?(:root)
    Rails.root
  else
    Pathname.new(Dir.pwd)
  end
end

.environmentObject



50
51
52
53
54
55
56
# File 'lib/valkyrie.rb', line 50

def environment
  if const_defined?(:Rails) && Rails.respond_to?(:env)
    Rails.env
  else
    ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
  end
end

.loggerObject



66
67
68
# File 'lib/valkyrie.rb', line 66

def logger
  @logger ||= Logger.new(STDOUT)
end

.logger=(logger) ⇒ Object



70
71
72
# File 'lib/valkyrie.rb', line 70

def logger=(logger)
  @logger = logger
end

.warn_about_standard_queries!Object



74
75
76
77
# File 'lib/valkyrie.rb', line 74

def warn_about_standard_queries!
  warn "[DEPRECATION] Please enable query normalization to avoid inconsistent results between different adapters by adding `standardize_query_results: true` to your environment block" \
   " in config\/valkyrie.yml. This will be the behavior in Valkyrie 2.0."
end