Class: Dry::Credentials::Settings
- Inherits:
-
Object
- Object
- Dry::Credentials::Settings
- Defined in:
- lib/dry/credentials/settings.rb
Constant Summary collapse
- DEFAULT_SETTINGS =
{ env: -> { ENV['APP_ENV'] }, dir: 'config/credentials', cipher: 'aes-256-gcm', digest: 'sha256', serializer: Marshal }.freeze
Instance Method Summary collapse
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
- #method_missing(key, value = nil) ⇒ Object
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
15 16 17 |
# File 'lib/dry/credentials/settings.rb', line 15 def initialize @settings = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, value = nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/dry/credentials/settings.rb', line 19 def method_missing(key, value=nil) fail Dry::Credentials::UnrecognizedSettingError, key unless DEFAULT_SETTINGS.has_key? key if value @settings[key] = value else resolve(@settings[key] || DEFAULT_SETTINGS[key]) end end |