google / globalfoundries-pdk-libs-gf180mcu_fd_pv

Apache License 2.0
12 stars 6 forks source link

Consider using a config hash for managing default value #37

Open proppy opened 1 year ago

proppy commented 1 year ago

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