Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hash with "default" key #33

Open
hidenwer opened this issue Apr 19, 2022 · 0 comments
Open

Hash with "default" key #33

hidenwer opened this issue Apr 19, 2022 · 0 comments

Comments

@hidenwer
Copy link

Hey,

Is there a workaround for the cases when hash includes keys named "default"?

Ex.:

hash = {
  "key0" => {
    "default" => { "key" => "value" }
  }
}
[5] pry(#<Controller>)> hash = {
  "key0" => {
    "default" => { "key" => "value" }
  }
=> {"key0"=>{"default"=>{"key"=>"value"}}}

[6] pry(#<Controller>)> hash.to_dot
=> {"key0"=>{"default"=>{"key"=>"value"}}}

[7] pry(#<Controller>)> hash.key0
=> {"default"=>{"key"=>"value"}}

[8] pry(#<Controller>)> hash.key0.default
=> nil

Found the default setting but that seems to be a bit different from what I've faced.

Thank you.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant