Sha256: 5ef8f7050294509a14c88ba7b40b7c03c00debd8f4c8c284a04962e2a7d17c38

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

module Dry
  module System
    module Plugins
      # @api public
      class Env < Module
        DEFAULT_INFERRER = -> { :development }

        attr_reader :options

        # @api private
        def initialize(options)
          @options = options
        end

        def inferrer
          options.fetch(:inferrer, DEFAULT_INFERRER)
        end

        # @api private
        def extended(system)
          system.setting :env, default: inferrer.(), reader: true
          super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-system-0.22.0 lib/dry/system/plugins/env.rb
dry-system-0.21.0 lib/dry/system/plugins/env.rb
dry-system-0.20.0 lib/dry/system/plugins/env.rb