Sha256: f21cc5fe4d1d7b8fe8e46e12a7c375ece0170f9ef4fc36f4044095a01d9d6c4e
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require "cogger" require "containable" require "etcher" require "http" require "runcom" require "spek" module Pennyworth # Provides a global gem container for injection into other objects. module Container extend Containable register :configuration do self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active)) .then { |registry| Etcher.call registry } end register :defaults do Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model) .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path])) end register(:specification) { Spek::Loader.call "#{__dir__}/../../pennyworth.gemspec" } register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") } register(:xdg_config) { Runcom::Config.new "pennyworth/configuration.yml" } register(:logger) { Cogger.new id: :pennyworth } register :http, HTTP register :kernel, Kernel end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pennyworth-16.5.0 | lib/pennyworth/container.rb |
pennyworth-16.4.0 | lib/pennyworth/container.rb |