Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat result of to_h to be hashes recursively
Config gem version 3.0 removed the dot access from .to_h resulting values intentionally. See: https://www.github.com/rubyconfig/config/issues/217 In config 2.2.3, the result of: ``` Api::ApiConfig.collections.to_h ``` was: ``` (byebug) Api::ApiConfig.collections.to_h {:accounts=>#<Config::Options description="Accounts", options=[:subcollection], verbs=[:get], klass="Account">, :actions=>#<Config::Options description="Actions", identifier="miq_action", options=[:collection], verbs=[:get, :put, :post, ... ``` With values being Config::Options objects. In config gem 5.5.2, they're hashes all the way down: ``` (byebug) Api::ApiConfig.collections.to_h {:accounts=>{:description=>"Accounts", :options=>[:subcollection], :verbs=>[:get], :klass=>"Account"}, :actions=>{:description=>"Actions", :identifier=>"miq_action", :options=>[:collection], :verbs=>[:get, :put, :post, :patch, :delete], ... ``` Note, if you don't convert to hash, you retain the Config::Options structure and API: ``` (byebug) Api::ApiConfig.collections ... ``` It's easy enough to change the access to assume nested hashes all the way down, which is also compatible with existing Config::Options behavior.
- Loading branch information