-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Hash as a possible config value #131
Conversation
I'm not sure what the actual problem is. Could you rephrase the description somehow? ie why is it trying to call |
require 'dry-configurable'
class Xxx
extend Dry::Configurable
setting :xxx
end
Xxx.configure do |config|
config.update(xxx: {})
end leads to
because it implies that setting is a |
Also: require 'dry-configurable'
class Xxx
extend Dry::Configurable
setting :xxx, default: {x: 1}
end
Xxx.configure do |config|
config.update(xxx: {y: 2})
end
p Xxx.config.to_h # => {:xxx=>{:x=>1, :y=>2}} |
OTOH now we can overwrite |
BTW, shouldn't
|
Added |
😿 |
This all makes sense and looks good to me! I'll update the is_a?(Hash) check to use |
Released in 0.15.0: https://github.com/dry-rb/dry-configurable/releases/tag/v0.15.0 |
It's handy to do something like
to have decrypted key in the settings instead of two strings, but dry-c complains that
nil
doesn't have#update
. I suppose there is an expectation that if we're assigning a Hash — value is defined bysetting
, we shouldn't expect that.