Class: HttpApiClient::Config
- Inherits:
-
Object
- Object
- HttpApiClient::Config
- Defined in:
- lib/http_api_client/config.rb
Constant Summary collapse
- DEFAULT_CONFIG_FILE_LOCATION =
'config/http_api_clients.yml'
Instance Method Summary collapse
-
#initialize(config_file = DEFAULT_CONFIG_FILE_LOCATION) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config_file = DEFAULT_CONFIG_FILE_LOCATION) ⇒ Config
Returns a new instance of Config.
12 13 14 15 16 17 18 |
# File 'lib/http_api_client/config.rb', line 12 def initialize(config_file = DEFAULT_CONFIG_FILE_LOCATION) if File.exists?(config_file) @config = symbolize_keys(config_for(config_file, HttpApiClient.env)) else raise "Could not load config file: #{config_file}" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
24 25 26 27 28 29 30 |
# File 'lib/http_api_client/config.rb', line 24 def method_missing(method, *args, &block) if config[method] OpenStruct.new(config[method]) else super end end |