Sha256: 046d16f135078f2754868071953d3c950490f0066531421b4c1f8913c4537c44

Contents?: true

Size: 549 Bytes

Versions: 13

Compression:

Stored size: 549 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, inferrer.(), reader: true
          super
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dry-system-0.19.2 lib/dry/system/plugins/env.rb
dry-system-0.18.2 lib/dry/system/plugins/env.rb
dry-system-0.19.1 lib/dry/system/plugins/env.rb
dry-system-0.19.0 lib/dry/system/plugins/env.rb
dry-system-0.18.1 lib/dry/system/plugins/env.rb
dry-system-0.18.0 lib/dry/system/plugins/env.rb
dry-system-0.17.0 lib/dry/system/plugins/env.rb
dry-system-0.15.0 lib/dry/system/plugins/env.rb
dry-system-0.14.1 lib/dry/system/plugins/env.rb
dry-system-0.14.0 lib/dry/system/plugins/env.rb
dry-system-0.13.2 lib/dry/system/plugins/env.rb
dry-system-0.13.1 lib/dry/system/plugins/env.rb
dry-system-0.13.0 lib/dry/system/plugins/env.rb