Module: Puppet_X::EnterpriseModules::Oci::Settings
- Included in:
- AssociatedProperty, AssociatedProperty, NameResolver, PuppetTask, ResourceLister
- Defined in:
- lib/puppet_x/enterprisemodules/oci/settings.rb
Overview
Add Documentation
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
-
#read_from_yaml ⇒ Object
rubocop: disable Security/Open.
- #setting_for(key) ⇒ Object
- #settings ⇒ Object
-
#settings_file ⇒ Object
rubocop: enable Security/Open.
Class Method Details
.included(parent) ⇒ Object
12 13 14 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 12 def self.included(parent) parent.extend(Settings) end |
Instance Method Details
#configuration ⇒ Object
20 21 22 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 20 def configuration @configuration ||= read_from_yaml end |
#read_from_yaml ⇒ Object
rubocop: disable Security/Open
29 30 31 32 33 34 35 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 29 def read_from_yaml if File.exist?(settings_file) open(settings_file) { |f| YAML.safe_load(f) } else { 'default' => {} } end end |
#setting_for(key) ⇒ Object
16 17 18 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 16 def setting_for(key) settings[key] end |
#settings ⇒ Object
24 25 26 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 24 def settings configuration[environment] end |
#settings_file ⇒ Object
rubocop: enable Security/Open
38 39 40 |
# File 'lib/puppet_x/enterprisemodules/oci/settings.rb', line 38 def settings_file Pathname.new(SETTINGS_FILE). end |