Class: Chronos::Configuration::Snapshot
- Inherits:
-
Object
- Object
- Chronos::Configuration::Snapshot
- Defined in:
- lib/chronos/configuration.rb
Overview
Immutable configuration shared by all runtime components.
Instance Method Summary collapse
- #enabled_for_environment? ⇒ Boolean
-
#initialize(values) ⇒ Snapshot
constructor
A new instance of Snapshot.
Constructor Details
#initialize(values) ⇒ Snapshot
Returns a new instance of Snapshot.
125 126 127 128 129 130 131 132 |
# File 'lib/chronos/configuration.rb', line 125 def initialize(values) ATTRIBUTES.each do |attribute| value = values[attribute] value.freeze if value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) instance_variable_set("@#{attribute}", value) end freeze end |
Instance Method Details
#enabled_for_environment? ⇒ Boolean
134 135 136 |
# File 'lib/chronos/configuration.rb', line 134 def enabled_for_environment? enabled && !ignored_environments.map(&:to_s).include?(environment.to_s) end |