You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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.
Could this lead to cleaner, more efficient code than the exception rescue?
The text was updated successfully, but these errors were encountered:
See comment here: olbrich/ruby-units#156 (comment)
@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.
Could this lead to cleaner, more efficient code than the exception rescue?
The text was updated successfully, but these errors were encountered: