units: support mm

Closes #161
This commit is contained in:
Andy Meneely
2016-06-27 11:10:39 -04:00
parent acd04b34a3
commit 4ea30c63e2
7 changed files with 77 additions and 2 deletions
+5
View File
@@ -13,5 +13,10 @@ module Squib
@dpi * Squib::INCHES_IN_CM * n.to_f
end
# DSL method. See http://squib.readthedocs.io
def mm(n)
@dpi * Squib::INCHES_IN_CM * n.to_f / 10.0
end
end
end
+2
View File
@@ -15,6 +15,8 @@ module Squib
arg.rstrip[0..-2].to_f * dpi
when /cm$/ # ends with "cm"
arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM
when /mm$/ # ends with "mm"
arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM / 10.0
else
arg
end