Closed thegedge closed 7 years ago
What range would this go to by default? 109 to 10-9 or even more?
I have started on this, and I don't know if the approach I am taking is good.
I was going to create a class Measured::SIUnitSystemBuilder
with def si_unit(unit_name, aliases: [], value: nil, range = 9)
The class would have two arrays, each with every 3 prefixes, and they can be as long as needed
[:k, :M, :G]
, and [:m, :μ, :n]
would be snippets of them
Then something would iterate over these and call build_unit
them, with default aliases "#{unit_name}s"
And set the value of the unit relative to the si base unit.
Am I on the right track here?
Also, I wasn't sure why with_si_prefixes: true
is needed. Can't si_unit
build the base unit, as well as ones with all of the prefixes?
I'm thinking we could add an SI helper when building a unit system, which will generate units with the SI prefixes added. Something along the lines:
This would generate kilograms, megagrams, micrograms, etc.