Class: Dry::System::Plugins::Env

Inherits:
Module
  • Object
show all
Defined in:
lib/dry/system/plugins/env.rb

Constant Summary collapse

DEFAULT_INFERRER =
-> { :development }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Env

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Env.


11
12
13
# File 'lib/dry/system/plugins/env.rb', line 11

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)


8
9
10
# File 'lib/dry/system/plugins/env.rb', line 8

def options
  @options
end

Instance Method Details

#extended(system) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


20
21
22
23
# File 'lib/dry/system/plugins/env.rb', line 20

def extended(system)
  system.setting :env, inferrer.(), reader: true
  super
end

#inferrerObject


15
16
17
# File 'lib/dry/system/plugins/env.rb', line 15

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