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.



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

def initialize(**options)
  @options = options
  super()
end

Instance Attribute Details

#optionsObject (readonly)



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

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.



23
24
25
26
# File 'lib/dry/system/plugins/env.rb', line 23

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

#inferrerObject



18
19
20
# File 'lib/dry/system/plugins/env.rb', line 18

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