Class: Contrast::Config::BaseConfiguration
- Extended by:
- Forwardable
- Defined in:
- lib/contrast/config/base_configuration.rb
Overview
This is the base for our configuration classes. It is intended to facilitate the translation of the Common Configuration settings to usable Ruby classes.
Direct Known Subclasses
AgentConfiguration, ApplicationConfiguration, AssessConfiguration, AssessRulesConfiguration, ExceptionConfiguration, HeapDumpConfiguration, InventoryConfiguration, LoggerConfiguration, ProtectConfiguration, ProtectRuleConfiguration, ProtectRulesConfiguration, RootConfiguration, RubyConfiguration, SamplingConfiguration, ServerConfiguration, ServiceConfiguration
Constant Summary collapse
- BOOLEANS =
[true, false].cs__freeze
- EMPTY_VALUE =
:EMPTY_VALUE
Instance Attribute Summary collapse
-
#map ⇒ Object
(also: #to_hash)
readonly
Returns the value of attribute map.
Instance Method Summary collapse
- #assign_value_to_path_array(dot_path_array, value) ⇒ Object
-
#initialize(hsh = {}, keys = {}) ⇒ BaseConfiguration
constructor
A new instance of BaseConfiguration.
- #nil? ⇒ Boolean
Constructor Details
#initialize(hsh = {}, keys = {}) ⇒ BaseConfiguration
Returns a new instance of BaseConfiguration.
27 28 29 30 |
# File 'lib/contrast/config/base_configuration.rb', line 27 def initialize hsh = {}, keys = {} @map = {} traverse_config(hsh, keys) end |
Instance Attribute Details
#map ⇒ Object (readonly) Also known as: to_hash
Returns the value of attribute map.
17 18 19 |
# File 'lib/contrast/config/base_configuration.rb', line 17 def map @map end |
Instance Method Details
#assign_value_to_path_array(dot_path_array, value) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/contrast/config/base_configuration.rb', line 32 def assign_value_to_path_array dot_path_array, value current_level = self dot_path_array[0...-1].each do |segment| current_level = current_level.send(segment) if current_level.cs__respond_to?(segment) end last_entry = dot_path_array[-1] current_level.send("#{ last_entry }=", value) if current_level.nil? == false && current_level.cs__respond_to?(last_entry) nil end |
#nil? ⇒ Boolean
42 43 44 |
# File 'lib/contrast/config/base_configuration.rb', line 42 def nil? @map.empty? end |