Passing in dynamic parameter names to Origen::Parameters?

40 views Asked by At

After looking at the Origen Parameters feature, I was wondering if it is possible to dynamically pass variables as names within the parameter scope. For example:

[:tprog, :terase].each do |p|
  define_params :default do |params|
    params.send(p, 20.uS)
  end
end

thx

1

There are 1 answers

0
Ginty On BEST ANSWER

Yes it's possible.

Your example doesn't work as written though since the method you are trying to call to define the parameter is tprog= and not just tprog.

So this would work:

[:tprog, :terase].each do |p|
  define_params :default do |params|
    params.send("#{p}=", 20.us)
  end
end