Feature Request/Question: Unit.is_valid?("unitname")
Hey there! I'm wondering if there's currently a way to do something like the above, or what you recommend if one wanted to determine whether or not one is using a valid unit, or if you think it's better to rescue the exception. Thanks!
right now you will have to rescue the exception thrown when parsing. It's a good suggestion that I will explore incorporating in the next version.
Thanks much!
@johnhutch I think you can use Unit.defined?("unitname") for this purpose.
Edit: Unit.defined? does not recognize prefixes so it won't work for those cases e.g. Unit.defined?('cm') is false but Unit.new('cm') will work.