Skip to content
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

Consider using a config hash for managing default value #37

Open
proppy opened this issue Feb 6, 2023 · 0 comments
Open

Consider using a config hash for managing default value #37

proppy opened this issue Feb 6, 2023 · 0 comments

Comments

@proppy
Copy link
Member

proppy commented Feb 6, 2023

Currently the DRC rules rely on conditional to set the default value from global variables.

It would be nice to consolidate those in configuration hashes at the top of the DRC script, we can them rely on the https://docs.ruby-lang.org/en/3.2/Hash.html#method-i-merge function to apply the default.

irb(main):036:0> $a = false
=> false
irb(main):037:0> default = {:a => true, :b => false}
=> {:a=>true, :b=>false}
irb(main):038:0> config = default.merge({:a => $a})
=> {:a=>false, :b=>false}
irb(main):039:0> config[:a]
=> false
irb(main):042:0> config[:b]
=> false
@FaragElsayed2 FaragElsayed2 mentioned this issue Feb 6, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant