Module: Valkyrie

Defined in:
lib/valkyrie/engine.rb,
lib/valkyrie.rb,
lib/valkyrie/id.rb,
lib/valkyrie/types.rb,
lib/valkyrie/logging.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, Logging, MetadataAdapter, Resource, StorageAdapter, ValueMapper

Constant Summary collapse

VERSION =
"3.3.0"

Class Method Summary collapse

Class Method Details

.configObject



31
32
33
34
35
# File 'lib/valkyrie.rb', line 31

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

.config_fileObject



37
38
39
40
# File 'lib/valkyrie.rb', line 37

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



42
43
44
45
# File 'lib/valkyrie.rb', line 42

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

.config_root_pathObject



55
56
57
58
59
60
61
# File 'lib/valkyrie.rb', line 55

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

.environmentObject



47
48
49
50
51
52
53
# File 'lib/valkyrie.rb', line 47

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

.loggerValkyrie::Logging

Returns:



72
73
74
# File 'lib/valkyrie.rb', line 72

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

.logger=(logger) ⇒ Object

Wraps the given logger in an instance of Valkyrie::Logging

Parameters:

  • logger (Logger)


79
80
81
# File 'lib/valkyrie.rb', line 79

def logger=(logger)
  @logger = Valkyrie::Logging.new(logger: logger)
end

.root_pathObject



63
64
65
66
67
68
69
# File 'lib/valkyrie.rb', line 63

def root_path
  if Valkyrie.const_defined?(:Engine)
    Valkyrie::Engine.root
  else
    Pathname.new(__dir__).dirname
  end
end