Class: Uses::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/uses/config.rb

Constant Summary collapse

ON_CIRCULAR_DEPENDENCY_VALUES =
[
  :ignore,
  :raise_error,
  :warn,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
# File 'lib/uses/config.rb', line 16

def initialize
  reset!
end

Instance Attribute Details

#initializersObject (readonly)

The array of custom initializers. Generally you should use ‘Uses.initializers do |initializers|` to manipulate this



14
15
16
# File 'lib/uses/config.rb', line 14

def initializers
  @initializers
end

#on_circular_dependencyObject

Configure what should happen when a circular dependency is detected.

:warn

Emit a warning, but allow it (default)

:raise_error

Raise an exception, effectively making your app unusable until you resolve the circular dependencies

:ignore

Emit a warning at DEBUG level, effectively allowing you to ignore these issues.



10
11
12
# File 'lib/uses/config.rb', line 10

def on_circular_dependency
  @on_circular_dependency
end

Instance Method Details

#reset!Object



20
21
22
23
# File 'lib/uses/config.rb', line 20

def reset!
  self.on_circular_dependency = :warn
  @initializers = {}
end