Class: Carioca::Services::Config::Settings

Inherits:
Hash
  • Object
show all
Includes:
Helpers
Defined in:
lib/carioca/services/config.rb

Overview

A setting object

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#debug, #i18n, #log, #search_file_in_gem

Methods inherited from Hash

#deep_symbolize, #method_missing

Constructor Details

#initialize(config_filename:, stage:, root:) ⇒ Settings

Returns a new instance of Settings.



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/carioca/services/config.rb', line 84

def initialize(config_filename:, stage:, root:)
  super
  registry = Carioca::Registry.get
  @logger = registry.get_service name: :logger
  @i18n = registry.get_service name: :i18n
  @debug = Carioca::Registry.config.debug?
  @stage = stage
  @root = root
  @config_file = Carioca::Services::Config::ConfigFile.new filename: config_filename
  initconf
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hash

Instance Attribute Details

#config_fileObject

Returns the value of attribute config_file.



80
81
82
# File 'lib/carioca/services/config.rb', line 80

def config_file
  @config_file
end

#stageObject

Returns the value of attribute stage.



80
81
82
# File 'lib/carioca/services/config.rb', line 80

def stage
  @stage
end

Instance Method Details

#refreshObject



96
97
98
# File 'lib/carioca/services/config.rb', line 96

def refresh
  initconf
end