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